winform Timer控件的使用

private void button1_Click(object sender, EventArgs e){
                    Timer timer1 = new Timer();
                    timer1.Interval = 1000;
                    timer1.Enabled = truestyle="color: #000000;">;
                    timer1.Tick += new EventHandler(timer1EventProcessor);//添加事件
}    

 private void timer1EventProcessor(object sender, EventArgs e)
        {
            do sth……
        }
System.Windows.Forms中Timer的用法

 

Timer t = new Timer(p => FlushData(), autoEvent, 0, 10000);// 第一个参数是:回调方法,表示要定时执行的方法,第二个参数是:回调方法要使用的信息的对象,或者为空引用,第三个参数是:调用 callback 之前延迟的时间量(以毫秒为单位),指定 Timeout.Infinite 以防止计时器开始计时。指定零 (0) 以立即启动计时器。第四个参数是:定时的时间时隔,以毫秒为单位
System.Threading.Timer的用法
原文地址:https://www.cnblogs.com/vichin/p/9018031.html