//定一个倒序的时间
TimeSpan dto = new TimeSpan(0, 20, 0);
private void timer1_Tick(object sender, EventArgs e)
{
//倒序时间已秒的形式相减
dto = dto.Subtract(new TimeSpan(0, 0, 1));
label1.Text = string.Format("{0}分:{1}秒",dto.Minutes,dto.Seconds);
//如果总的秒数已经到0了,停止计数器
if (dto.TotalSeconds<=0.0)
{
timer1.Stop();
button1.Enabled = false;
MessageBox.Show("答题时间到了!");
}
}