夏天哥哥

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

C#定时器Timer的使用

 

引用代码:

 

this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
this.timer1.Enabled = true;

 

private void timer1_Tick(object sender, EventArgs e)
{
DateTime dt
= DateTime.Now;
ArrayList AT
= new ArrayList();
AT.Add(
"19:16:00");
AT.Add(
"19:16:10");
AT.Add(
"19:16:20");
for (int i=0; i<=2;i++ )
{
if (dt.ToLongTimeString().Equals(AT[i]))
{
MessageBox.Show(AT[i]
+"到了!");
}
}

}

 

 

 

 

posted on 2010-11-04 19:23  夏天哥哥  阅读(246)  评论(0编辑  收藏  举报