【发布时间】:2012-12-04 08:15:42
【问题描述】:
我正在Form_Paint() 事件中使用e.Graphics.DrawImage 绘制图像。我使用Timer 刷新表单。问题是动画闪烁。似乎更新e 的时间太长了。我在表单中有 2 个PictureBox。
想法?
更新:
public Bitmap Paint(int state, Graphics g)
{
this.state = state;
Bitmap temp;
Graphics tempGraphics;
temp = new Bitmap(45, 47, g);
tempGraphics = Graphics.FromImage(temp);
switch (state)
{
case 0:
tempGraphics.DrawImageUnscaled(img, x, y);
break;
case 1:
tempGraphics.DrawImageUnscaled(img, x, y - 42);
break;
}
}
这会在将精灵添加到表单之前准备好精灵。
【问题讨论】: