欢迎您访问我爱IT技术网,今天小编为你分享的编程技术是:【C#定时器的使用】,下面是详细的分享!
C#定时器的使用
Timer timer1;
this.timer1.Interval=1000;
this.timer1.Tick +=new System.EventHandler(this.timer1_Tick);
private void timer1_Tick(object sender, EventArgs e)
{
ArrayList AutoTask=new ArrayList();
AutoTask.Add("8:30:00");
AutoTask.Add("9:30:00");
AutoTask.Add("10:30:00");
AutoTask.Add("11:30:00");
for (int n=0; n < 4; n++)
{
if (dtAuto.ToLongTimeString().Equals(AutoTask[n]))
{
MessageBox.Show("现在时间是" + AutoTask[n]);
}
}
}
以上所分享的是关于C#定时器的使用,下面是编辑为你推荐的有价值的用户互动:
相关问题:c#中多线程和定时器的使用
答:感觉你这个用一个线程和一个TIMER就可以了, 思路,线程一的代码执行完,启动TIMER,并挂起线程,TIMER时间到,停止TIMER,唤醒线程,就循环下去了,你搞两个线程,可能你没那么好控制,这样就不用反复的建立线程那些, >>详细
相关问题:c#定时器使用问题
答:timer1.Interval = int.Parse(textBox2.Text.Trim());Clipboard.SetText(textBox1.Text);//复制textBox1里的内容到剪辑版 >>详细
相关问题:C#后台设置定时器
答:先放一个Timer控件到窗口上 public void SetTime(){ timer1.Enabled = true;//设置为truetimer1_Tick实践就会执行,开始计时 timer1.Interval = 1000;//设置timer1的timer1_Tick实践执行周期为1000毫秒 }private void timer1_Tick(object sender... >>详细
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
