你可以不直接画到屏幕上,而是先画到一个Bitmap上,然后在窗体的Paint操作时将Bitmap画到窗体上,其实这也就是所谓的双缓冲。class Test :Form
{
private Bitmap bmp;public Test()
{
bmp = new Bitmap(this.Width,this.Height);
this.Paint+=new PaintEventArgs(Test_OnPaint);
}private void Test_OnPaint(object sender,PaintEventArgs e)
{
e.Graphics.DrawImage(bmp,0,0);
}
}然后在你要画图时用:
using(Graphics grfx = Graphics.FromImage(bmp))
{
//用grfx画图
}