如何链接定时器C# [英] How to link timers C#

查看:82
本文介绍了如何链接定时器C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何连接定时器,如果一个定时器停止,它会启动下一个定时器?

how can I link timers that if the one timer stops it starts the next timer?

推荐答案

没有意义。计时器定期滴答,不知道吗? (除非这是一个众所周知的不准确的 System.Windows.Forms.Timer ;永远不要将它用于任何周期性重复的动作。)



在许多情况下,你需要一个带循环的单独线程和 Sleep ,这更直接。



-SA
Makes no sense. The timer "ticks" periodically, did no know that? (Unless this is a notoriously inaccurate System.Windows.Forms.Timer; never use it for any periodically repeated action.)

In many cases, you rather need a separate thread with a loop and Sleep, which is way more straightforward.

—SA


在计时器刻度事件中将下一个计时器设置为已启用
In the timer tick event set the next timer to be "Enabled"


在计时器刻度事件中使用此代码:

Use this code in timer tick event:
frsttimer.stop();
Scndtimer.start();


这篇关于如何链接定时器C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆