简体   繁体   English

显示标签文字10秒钟

[英]display text of label for 10 seconds

im using windows form application..using c# . 我正在使用Windows窗体应用程序..使用c#。 i have a label that displays some text when i click a buttom. 我有一个标签,当我单击按钮时会显示一些文本。 now i want the label to display its text only for 10 seconds and later it should get disabled. 现在,我希望标签仅显示其文本10秒钟,以后应将其禁用。

You will need to use a Timer , set it to 10 seconds when the form loads (or whenever you need it to). 您将需要使用Timer ,在加载表单时(或需要加载时)将其设置为10秒。

In the timer Tick event, you can disable the label control (or set its text to string.Empty , or whatever you need). 在计时器Tick事件中,您可以禁用标签控件(或将其文本设置为string.Empty或所需的任何内容)。 You will also need to stop the timer at that point, or it will keep firing every 10 seconds. 您还需要在此时停止计时器,否则它将保持每10秒触发一次。

there is a control name timer.you can find it in toolbox use that control and set time in it and assign a work in its code body.it will work 有一个控件名称计时器。您可以在工具箱中找到该计时器,使用该控件并在其中设置时间并在其代码主体中分配一项工作。

here is the link 链接在这里

http://msdn.microsoft.com/en-us/library/system.windows.forms.timer.aspx http://msdn.microsoft.com/zh-CN/library/system.windows.forms.timer.aspx

If you got solution from my answer then click my answer and vote me.thanx 如果您从我的答案中获得解决方案,请单击我的答案并投票给我.thanx

这里看看Timer类的例子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM