本文介绍了控制计时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好 在特定事件发生后如何让计时器工作? 加载表单时不起作用... 敌人示例:消息后 感谢
hello how can I let timer work after specific event ? not work when the form is loaded ... foe example : after message thanks
推荐答案您可以通过以下几种方法进行此操作.在窗体上放置一个计时器控件,或在代码中创建它.无论哪种方式,都可以将Enabled属性设置为false,直到要启动它为止.然后将其设置为true.这是有关如何执行此操作的教程: www.c-sharpcorner/UploadFile/mahesh/WorkingwithTimerControlinCSharp11302005054911x/ [ ^ ] 在您的情况下,您应该先禁用计时器.然后,在消息弹出(或发生)之后,您将启用计时器.在设置的时间后,将触发计时器事件. 还应注意,计时器具有Start方法和Stop方法.它们的作用与分别将Enabled设置为true和false相同. There are a couple ways you can do this. Either put a timer control on your form or create it in your code. Either way, you can set the Enabled property to false until you want to start it. Then set it to true. Here is a tutorial on how to do so: www.c-sharpcorner/UploadFile/mahesh/WorkingwithTimerControlinCSharp11302005054911AM/WorkingwithTimerControlinCSharp.aspx[^] In your situation, you would start with the timer disabled. Then, after your message pops up (or however it happens), you would enable the timer. After the set amount of time, the timer event would fire. It is also good to note that the timer has a Start method and a Stop method. These do the same thing as setting the Enabled to true and false respectively.
检查以下链接以更好地理解 www.vbdotnetheaven/uploadfile/mahesh/timercontrol04262005033148am/timercontrol.aspx [ ^ ] check the following link to understand better www.vbdotnetheaven/uploadfile/mahesh/timercontrol04262005033148am/timercontrol.aspx[^]
更多推荐
控制计时器
发布评论