C# pictureBox控件中绘制动态图形时闪烁怎么解决? 20
下面是绘图代码。我已经用了双缓存了啊!可还是闪烁。怎么解决啊?(很急啊!)voidTimers_Timer_Elapsed(objectsender,System.Tim...
下面是绘图代码。我已经用了双缓存了啊!可还是闪烁。怎么解决啊?(很急啊!)
void Timers_Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
double x = 200 + 100* Math.Sin(num * Math.PI / 180);
double y = 120 - 100 * Math.Cos(num * Math.PI / 180);
label1.Text = Convert.ToString((num = num + 0.1)); //显示到lable
Graphics p = pictureBox1.CreateGraphics();
Bitmap bmp = new Bitmap(600, 600);
Graphics g = Graphics.FromImage(bmp);
g.DrawLine(new Pen(Color.Black), (float)200, (float)120, (float)x, (float)y);
p.DrawLine(new Pen(Color.Black), (float)200, (float) 120, (float)x, (float)y);
pictureBox1.CreateGraphics().DrawImage(bmp, 0, 0);
pictureBox1.Invalidate();
} 展开
void Timers_Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
double x = 200 + 100* Math.Sin(num * Math.PI / 180);
double y = 120 - 100 * Math.Cos(num * Math.PI / 180);
label1.Text = Convert.ToString((num = num + 0.1)); //显示到lable
Graphics p = pictureBox1.CreateGraphics();
Bitmap bmp = new Bitmap(600, 600);
Graphics g = Graphics.FromImage(bmp);
g.DrawLine(new Pen(Color.Black), (float)200, (float)120, (float)x, (float)y);
p.DrawLine(new Pen(Color.Black), (float)200, (float) 120, (float)x, (float)y);
pictureBox1.CreateGraphics().DrawImage(bmp, 0, 0);
pictureBox1.Invalidate();
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询