timer_Tick里面当if(progressBar1.Value == 0)时先把定时器停住,再用MessageBox.Show
progressBar1.Value==0么?最大值是1吧?
然后在弹出“时间到”的下一行,加上timer1.stop();
private void button1_Click(object sender, EventArgs e)
{
progressBar1.Value = 100;
this.timer1.Start();
} private void timer1_Tick(object sender, EventArgs e)
{
timer1.Interval = 1000;
progressBar1.PerformStep();
if (progressBar1.Value == 0)
{
timer1.Stop();
MessageBox.Show("时间到");
}
}
可以把代码贴出来看看吧。这样不知道原因