在C#中怎样在label中循环显示数组中的内容

User[] us = SelectAllChatRooms.GetChatRoomManagers(_RoomID.ToString(), user.SessionId);
for (int index = 0; index < us.Length; index++)
{
在label中循环显示数组中的值
}

第1个回答  2010-09-03
循环显示的话按照计算机的速度你估计根本看不到就直接到最后的值了
弄一个Time计时,然后定int count = 0 i< us.Length
每次time刷新以后i+1,当count = us以后time.close()关闭
如果要循环下去就重新count = 0让它自己慢慢继续循环就好了
第2个回答  2010-09-03
我将2楼的方法总结了一下写成代码如下:
private string[] arrayC = new string[3];
private int count=0;
private void Form1_Load(object sender, System.EventArgs e)
{
arrayC[0] = "Shirdrn";
arrayC[1] = "Hamtty";
arrayC[2] = "Saxery";
this.timer1.Enabled=true;
this.timer1.Interval=500;
}

private void timer1_Tick(object sender, System.EventArgs e)
{

int j=count%arrayC.Length;//循环得到该第几个数出现
this.label1.Text=arrayC[j].ToString();
count++;

}本回答被网友采纳
第3个回答  2010-09-03
用for循环是可以 效果就是一带而过 楼主得用timer控制数据显示时间
相似回答