System.Windows.Forms.Timer

System.Timers.Timer

System.Threading.Timer

关于这三者的区别,可以参见msdn     https://msdn.microsoft.com/zh-cn/library/System.Threading.Timer(v=vs.110).aspx

System.Threading.Timer is a simple, lightweight timer that uses callback methods and is served by thread pool threads. It is not recommended for use with Windows Forms, because its callbacks do not occur on the user interface thread.

System.Threading.Timer是一个简单的轻量级的计时器,通过使用callback 方法工作,并且由线程池上的线程提供服务。并不推荐将此计时器用于winform,因为它的回调方法不在UI线程上。

System.Windows.Forms.Timer is a better choice for use with Windows Forms.

System.Windows.Forms.Timer是用在winform上的更好选择

For server-based timer functionality, you might consider using System.Timers.Timer, which raises events and has additional features.

如果你需要使用基于服务器的计时器功能,你可以考虑使用System.Timers.Timer,它可以触发事件,并且有额外的功能

在winform中使用计时器的时候,会遇到以下问题:

如果你在计时器中刷新窗体,有使用Invoke方法的话,会出现提示,无法访问已释放的对象。

那么可以在窗体的关闭事件中,调用timer的Dispose方法。

最新文章

  1. MSER算法介绍
  2. SAPI训练文件存储位置
  3. 删除mysql
  4. Qt StyleSheet皮肤(黑色,比较好看,而且很全)
  5. 【Spring学习笔记-6】关于@Autowired与@Scope(BeanDefination.SCOPE_PROTOTYPE)
  6. 详解Android中的屏幕方向
  7. SQL SERVER 中 GO 的用法2
  8. 理解TCP/IP协议
  9. ZOJ 3609 Modular Inverse
  10. ca 证书、签名
  11. POJ 1052 Plato's Blocks
  12. Http请求 post get
  13. ajax异步的问题,(主要解决有时候前台打断点和不打断点结果不一样的问题,一般情况下是存在异步的问题)
  14. Puppeteer 应用容器化
  15. Linux学习历程——Centos 7 uptime 、free命令
  16. 用ASP.NET MVC仿站糗事百科
  17. Window Server 2008 R2 TFS2010 安装前的准备
  18. Ubuntu16.04安装xgboost
  19. Android.ApplicationCrash
  20. centos-linux热拔插scsi硬盘

热门文章

  1. Valid format values for declare-styleable/attr tags[转]
  2. JavaScript string array 数组
  3. JAVA里的String、Timestamp、Date相互转换(转)
  4. Educational Codeforces Round 13 E. Another Sith Tournament 概率dp+状压
  5. Ext学习-高级组件介绍
  6. SQL SERVER其它函数
  7. 求出1~13的整数中1出现的次数,并算出100~1300的整数中1出现的次数?为此他特别数了一下1~13中包含1的数字有1、10、11、12、13因此共出现6次,但是对于后面问题他就没辙了。ACMer希望你们帮帮他,并把问题更加普遍化,可以很快的求出任意非负整数区间中1出现的次数。
  8. PHP之cookie相关实例教程与经典代码
  9. Eclipse下如何导入jar包
  10. ZOJ 2724 Windows Message Queue (优先级队列,水题,自己动手写了个最小堆)