在 C# 中,在黑色背景(屏幕保护程序)下每 20 秒淡入和淡出图像且持续时间为 1 秒的最佳(资源最少)方法是什么?
(大约 350x130 像素的图像)。
我需要一个简单的屏幕保护程序,它将在一些低级别计算机 (xp) 上运行。
现在我正在对 pictureBox 使用此方法,但它太慢了:
private Image Lighter(Image imgLight, int level, int nRed, int nGreen, int nBlue)
{
Graphics graphics = Graphics.FromImage(imgLight);
int conversion = (5 * (level - 50));
Pen pLight = new Pen(Color.FromArgb(conversion, nRed,
nGreen, nBlue), imgLight.Width * 2);
graphics.DrawLine(pLight, -1, -1, imgLight.Width, imgLight.Height);
graphics.Save();
graphics.Dispose();
return imgLight;
}
请您参考如下方法:
你可能会像 msdn 上的这个例子一样使用颜色矩阵
http://msdn.microsoft.com/en-us/library/w177ax15%28VS.71%29.aspx
