c# winform 如何让imer控件在label上显示是一秒一秒的减少?
privatevoid刷卡_Load(objectsender,EventArgse){this.timer1.Interval=1000;this.timer1.Tic...
private void 刷卡_Load(object sender, EventArgs e)
{
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
this.timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (time > -1)
{
time--;
this.label3.Text = time.ToString();
this.label3.Refresh();
}
else
{
timer1.Stop();
this.Close();
MessageBox.Show("刷卡超时!","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
} 展开
{
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
this.timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (time > -1)
{
time--;
this.label3.Text = time.ToString();
this.label3.Refresh();
}
else
{
timer1.Stop();
this.Close();
MessageBox.Show("刷卡超时!","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询