首页 > 其他 > 详细

Timer计时器

时间:2016-10-25 19:20:10      阅读:232      评论:0      收藏:0      [点我收藏+]
public Form2()
{
   InitializeComponent();
   m_Timer();
}
void m_Timer()
{
   System.Timers.Timer t = new System.Timers.Timer(10000);   //实例化Timer类,设置间隔时间为10000毫秒;   
   t.Elapsed += new System.Timers.ElapsedEventHandler(theout); //到达时间的时候执行事件;   
   t.AutoReset = true;   //设置是执行一次(false)还是一直执行(true);   
   t.Enabled = true;     //是否执行System.Timers.Timer.Elapsed事件; 
}
public void theout(object source, System.Timers.ElapsedEventArgs e)   
{   
   MessageBox.Show("我在测试哦!O_0");   
}  

 

Timer计时器

原文:http://www.cnblogs.com/772933011qq/p/5997563.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!