如何让计时器选择一个按钮? [英] How to make a timer select a button?

查看:69
本文介绍了如何让计时器选择一个按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何让计时器选择一个按钮?

How do I make a timer select a button?

推荐答案

虽然您可以通过Timer.Tick事件强制按下按钮:

While you can "force" a button press from your Timer.Tick event:
myButton.PerformClick();

会这样做 - 但这不是一个好主意。就个人而言,我会将Click事件处理程序代码移动到一个方法中,并从Click处理程序和Timer.Tick事件中调用该方法。

Will do it - but it isn''t that good an idea. Personally, I would move the Click event handler code into a method, and call the method from the Click handler and the Timer.Tick events.


我认为你想要运行按钮点击事件计时器刻度事件。

使用

I think you want to run button click event on timer tick event.
Use
buttonname_click(sender, e);


这篇关于如何让计时器选择一个按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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