如何在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.