本文介绍了在Windows Form上计时而不进行轮询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在表单上以秒为单位显示当前时间.我的时钟必须显示秒,并且不担心性能.
I need to display current time with seconds on my form. My clock must display seconds and im afraid about performance.
- 有没有不轮询的方法吗?(某些系统事件还是什么?)
- 如果没有不轮询的方法,我应该使用
Date().getTime()
来获取计时器滴答事件中的当前时间吗?
- Is there any method without polling? (some system event or something?)
- If there is no method without polling - shall i use
Date().getTime()
to get current time in my timer tick event?
推荐答案
您应该只使用 System.Windows.Forms.Timer
并在每个窗口中显示 DateTime.Now
勾选.
You should just use a System.Windows.Forms.Timer
and display DateTime.Now
in each tick.
这篇关于在Windows Form上计时而不进行轮询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!