在C#里面,如何用label控件与timer控件循环显示一串数组?
展开全部
int a = 0;
private void timer1_Tick(object sender, EventArgs e)
{
if (a==0)
label1.Text = "一号铺同学";
if (a == 1)
label1.Text = "二号铺同学";
if (a == 2)
label1.Text = "三号铺同学";
if (a == 3)
label1.Text = "四号铺同学";
if (a == 4)
label1.Text = "五号铺同学";
a++;
if (a >= 5)
a = 0;
}
private void button1_Click(object sender, EventArgs e)
{
timer1.Enabled = true;
}
private void button2_Click(object sender, EventArgs e)
{
timer1.Enabled = false;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询