如何在c#windows应用程序中逐个显示标签 [英] How to show label one by one in c# windows application

查看:86
本文介绍了如何在c#windows应用程序中逐个显示标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的先生,

我想通过使用timer

Dear Sir,
I want to show label in one by one windows application in c#.net by using timer

推荐答案

设置在c#.net中的逐个窗口应用程序中显示标签将你的计时器调到适当的间隔(使用Interval属性 - 记住它是1/1000秒),然后在Tick事件中你要做的就是:

Set up your timer to the appropriate interval (using the Interval property - remember it is in 1/1000th of a second) then in the Tick event all you cave to do is something like:
myLabel.Text = myArrayOfTextStrings[index++];
if (index >= myArrayOfTextStrings.Length)
   {
   index = 0;
   }

请注意 index 需要是类级变量,即在任何方法之外声明。

Do note that index needs to be a class level variable, i.e. declared outside any method.


这篇关于如何在c#windows应用程序中逐个显示标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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