110,500
社区成员
发帖
与我相关
我的任务
分享
private void FadeDraw(Graphics g)
{
float[][] matrix = new float[][]{
new float[]{_opaque,0,0,0,0},
new float[]{0,_opaque,0,0,0},
new float[]{0,0,_opaque,0,0},
new float[]{0,0,0,_opaque,0},
new float[]{0,0,0,0,1.0f}};
ImageAttributes attributes = new ImageAttributes();
ColorMatrix colorMatrix = new ColorMatrix(matrix);
int width = _image.Width;
int height = _image.Height;
attributes.SetColorMatrix(
colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
g.DrawImage(
_image,
new Rectangle(0, 0, Width, Height),
0,
0,
width,
height,
GraphicsUnit.Pixel,
attributes);
attributes.Dispose();
}
设置_opaque的值
然后在timer控件来改变_opaque的值;