控制计时器

编程入门 行业动态 更新时间:2024-10-26 22:28:10
本文介绍了控制计时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

你好 在特定事件发生后如何让计时器工作? 加载表单时不起作用... 敌人示例:消息后 感谢

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[^]

更多推荐

控制计时器

本文发布于:2023-11-09 06:20:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1571611.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:计时器

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!