想实现类似示波器的图像平移失败了,大家帮忙看看问题出在哪里
private void pictureBox1_Paint(object sender, PaintEventArgs e){
int h = pictureBox1.Height;
graph = e.Graphics;
pictureBox1.BackColor = Color.Black;
for (int 线 = 0; 线 < 100; 线 = 线 + 10)
{
graph.DrawLine(线条, new Point(线, 0), new Point(线, 100));//竖线需X坐标=同
graph.DrawLine(线条1, new Point(0, 线), new Point(200, 线));//横线需Y坐标=同
graph.DrawLine(线条, new Point(线 + 100, 0), new Point(线 + 100, 100));//竖线需X坐标=同
}
for (int i = 0; i < 9; i++)
{
graph.DrawLine(p, i * 10, h - shuzu[i], (i+1) *10, h-shuzu[i+1]);
}
}
private void timer1_Tick(object sender, EventArgs e)
{
int len = 10;
for (int i = 0; i < len; i++)
{
//判断数组越界
if (i < len - 1)
{
shuzu[i] = shuzu[i + 1];
}
else
{
shuzu[len - 1] = rmd.Next(0,100);
}
}
Invalidate();
}
}
更多 0