添加倒数计时器 [英] add a countdown timer
本文介绍了添加倒数计时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在程序中添加一个倒数计时器.
我该怎么做?
I want add a countdown timer to my program.
How can I do it?
推荐答案
我会使用Thread
或BackgroundWorker
对象.我的回答不明确,因为您的问题不明确.
I would use aThread
or aBackgroundWorker
object. My answer is non-specific because your question was ambiguous.
讨论.NET中的各种计时器:
比较.NET Framework类库中的计时器类 [计时器的惊喜,以及如何避免它们 [
Discussion of the various timers in .NET :
Comparing the Timer Classes in the .NET Framework Class Library[^]
Great article : Timer surprises, and how to avoid them[^]
Basically you declare your timer, add an eventhandler to it, set the interval and start it.
Mind that Windows is not a RTOS, that means you are NOT guaranteed to be notified in time of the event.
Cheers
计时器 [<使用href ="http://msdn.microsoft.com/zh-cn/library/system.threading.timer.aspx" target ="_ blank" title ="New Window"> ^ ]类,您可以在调用指定的回调之前指定一个时间间隔.
问候
Espen Harlinn
The Timer[^] class allows you to specify an interval before calling the specified callback.
Regards
Espen Harlinn
这篇关于添加倒数计时器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文