你必须使用双缓冲和你没有要停止在背景上使用图像,您可以让所有内容都顺利运行。
你有几种方法可以做到这一点,快速的方式(大部分时间不够)是启用面板的doublebuffer
。
“缓慢”但更好的方法是使用Bitmap对象作为缓冲区来执行您自己的Double Buffer。 本示例创建一个“侧边缓冲区”并接受图像作为参数并使用创建的缓冲区进行绘制。
public void DrawSomething(Graphics graphics, Bitmap yourimage)
{
Graphics g;
Bitmap buffer = new Bitmap(yourimage.Width, yourimage.Height, graphics);
g = Graphics.FromImage(buffer);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
g.DrawImage(yourimage, 0, 0);
graphics.DrawImage(buffer, 0, 0);
g.Dispose();
}
在您的OnPaint事件中调用此函数。
顺便说一句...这只是一个双缓冲的例子。
干杯