一个关于Timer的问题
我希望程序在Timer中每秒执行一次,时间间隔也是设置成的1秒, 但是我却发现程序在1秒执行了3次。
把间隔改成半秒或者3秒, 都是半秒(3秒)执行3次。百思不得其解。。。
所以想请教各位高人,为啥不是一次一次执行,而是3次一起执行
代码如下:
private void timer1Tick(object sender, System.EventArgs e)
{
//画点
t1.Enabled = false;
gph.DrawEllipse(Pens.Black, cpt.X + (num + 1) * 40 - 1.5f, hy + sy * (maxline - d[num]) - 1.5f, 3, 3);
gph.FillEllipse(new SolidBrush(Color.Black), cpt.X + (num + 1) * 40 - 1.5f, hy + sy * (maxline - d[num]) - 1.5f, 3, 3);
//画数值
gph.DrawString(d[num].ToString(), new Font("宋体", 11), Brushes.Black, new PointF(cpt.X + (num + 1) * 40, hy + sy * (maxline - d[num])));
//画折线
if (num > 0)
gph.DrawLine(Pens.Red, cpt.X + (num + 1) * 40, hy + sy * (maxline - d[num]), cpt.X + num * 40, hy + sy * (maxline - d[num - 1]));
pictureBox1.Image = bmap;
num++;
if (num == 9)
{
t1.Stop();
t1.Close();
}
}