private void Progressing_Tick(object sender, EventArgs e) { progressBar1.PerformStep(); if (progressBar1.Value == progressBar1.Maximum) { countdownlabel.Text = "Time's up!"; OneSec.Stop(); Progressing.Stop(); // 計時器停止 } }
private void btnStart_Click(object sender, EventArgs e) { OneSec.Stop(); Progressing.Stop(); countdowntime = int.Parse(textBox1.Text); if (countdowntime != 0) { progressBar1.Value = progressBar1.Minimum; Progressing.Interval = 10 * countdowntime; OneSec.Start(); Progressing.Start(); } }