刚写C#时,使用Timer比较多的是System.Windows.Forms.Timer。这个控件使用起来比较简单一些,它直接继承自Component。在使用时,TImer控件绑定Tick时间,开始计时采用Timer.Start()或者TImer.enable=True后才会自定计时,停止时候采用TImer.stop()或者Timer.enable=false。在开始之前,需要设置一下Timer.Interval=100(时间间隔ms)。Timer控件和它所在的Form属于同一个线程,因此执行效率不是很高,不如新开一个线程采用system.Threading.Timer。
using System; using System.Windows.Forms; using System.Threading; namespace WindowsFormsApplication13 { public partial class