c# 点击按钮开始运行进度条

2024-12-16 18:05:48
推荐回答(4个)
回答1:

timer_Tick里面当if(progressBar1.Value == 0)时先把定时器停住,再用MessageBox.Show

回答2:

progressBar1.Value==0么?最大值是1吧?
然后在弹出“时间到”的下一行,加上timer1.stop();

回答3:

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("时间到");
}
}

回答4:

可以把代码贴出来看看吧。这样不知道原因