如何使用计时器更改文本框?在Visual Studio 2016中 [英] How do i change a Text Box using a Timer? In Visual Studio 2016

查看:91
本文介绍了如何使用计时器更改文本框?在Visual Studio 2016中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要我的计时器来更改文本框(30秒后,然后在10秒后再次更改。例如,用户检查一些框(复选框),然后显示他检查的文本框。例如,用户启动程序并且计时器启动
运行,30秒后它会在文本框中显示一个复选框。当时间结束时,它显示以前由程序制造商编写的内容(但仅限于10秒),当它用完时,它会在文本框中再次显示
不同复选框的内容。

任何人都可以帮助我吗?我不知道如何对不起,很抱歉。

I need my timer to change a text box (after 30 seconds, and then to change again after 10 seconds. For example, the user checks some boxes (Check box), and then the one he checks are shown. For example, the user starts the program and the timer starts running, for 30 seconds it shows on the text box one of the check box. When the time ends, it shows something previously written by the maker of the program (but only for 10 seconds), and when that runs out, it shows again on the text box the contents of a different check box.
Can anyone help me? I'm not sure how to even start. Sorry for the trouble.

推荐答案

首先拖动
计时器类(System.Windows.Forms)
从工具箱到表单。您可以在设计器或代码中更改某些属性。将Interval设置为t的数量你需要在刻度线之间。您可以在
执行期间更改Interval,因为您需要在执行期间多次更改它,您可以在执行期间执行此操作。除非Enabled属性为true,否则Timer被禁用。 Start方法将Enabled设置为true,或者您可以直接将该属性设置为true。
Crete Tick事件的处理程序。您可以在Tick事件处理程序中更改Interval。在更改Interval之前,我不确定是否应该调用Stop(或将Enabled属性设置为false)。如果您停止计时器,则需要在必要时再次启动
Start by dragging a Timer Class (System.Windows.Forms) from the Toolbox to the form. You can change some properties in the designer or in code. Set the Interval to the amount of time you need between ticks. You can change the Interval during execution and since you need to change it multiple times during execution you could do that during execution. The Timer is disabled unless the Enabled property is true. The Start method will set the Enabled to true or you can set the property to true directly. Crete a handler for the Tick event. You can change the Interval in the Tick event handler. I don't know for sure whether you should call Stop (or set the Enabled property to false) before changing the Interval. If you stop the Timer then you will need to start it again when necessary.


这篇关于如何使用计时器更改文本框?在Visual Studio 2016中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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