c#画曲线问题
随机产生数据,每产生一个点就调用画曲线的函数,函数如下,每次只刷新一小块,为什么曲线显示时偶尔曲线会断
private void DrawWave(int data)
{
Graphics graph = picture.CreateGraphics();
Pen pen = new Pen(Color.Black, 1);
SolidBrush solidBrush = new SolidBrush(Color.White);
graph.FillRectangle(solidBrush, x + 1, 0, 20, this.Height);
graph.DrawLine(pen, x, picture.Height / 2 - oldy, x + 1, picture.Height / 2 - data);
oldy= data;
x++;
if (x >= picture.Width)
x = 0;
}
是不是窗体自动重绘了背景?怎么解决
private void DrawWave(int data)
{
Graphics graph = picture.CreateGraphics();
Pen pen = new Pen(Color.Black, 1);
SolidBrush solidBrush = new SolidBrush(Color.White);
graph.FillRectangle(solidBrush, x + 1, 0, 20, this.Height);
graph.DrawLine(pen, x, picture.Height / 2 - oldy, x + 1, picture.Height / 2 - data);
oldy= data;
x++;
if (x >= picture.Width)
x = 0;
}
是不是窗体自动重绘了背景?怎么解决
...全文


