System.Windows.Forms.Timer只有Tick事件 运行执行两次
System.Timers.Timer只有Elapsed事件 运行执行一次
System.Timers.Timer 例子
System.Timers.Timer aTimer = new System.Timers.Timer();
aTimer.Elapsed += new ElapsedEventHandler(timer1_Tick);
Set the Interval to 5 seconds.
aTimer.Interval = 5000;
aTimer.Enabled = true;
private void timer1_Tick(object sender, EventArgs e)
{
MessageBox.Show("here");
}