那位高手能帮我看看这句话呀。
private void button1_Click(object sender, EventArgs e){
timer1.Enabled = true;
{
Random r = new Random();
label1.Text = r.Next(0, 9).ToString();
label2.Text = r.Next(0, 9).ToString();
label3.Text = r.Next(0, 9).ToString();
}
}
怎么样才可以点一下button叫这3个label的数字一直变化。 --------------------编程问答-------------------- private void button1_Click(object sender, EventArgs e)
{
//一秒发生一次变化
timer1.Interval = 1000;
timer1.Enabled = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
Random r = new Random();
label1.Text = r.Next(0, 9).ToString();
label2.Text = r.Next(0, 9).ToString();
label3.Text = r.Next(0, 9).ToString();
} --------------------编程问答--------------------
private void button1_Click(object sender, EventArgs e)
{
//一秒发生一次变化
timer1.Interval = 1000;
timer1.Enabled = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
Random r = new Random();
label1.Text = r.Next(0, 9).ToString();
label2.Text = r.Next(0, 9).ToString();
label3.Text = r.Next(0, 9).ToString();
}
----------------顶 --------------------编程问答-------------------- 要Button点一下才变化的话,用timer控件干什么!
直接写代码就可以了!
--------------------编程问答-------------------- 楼上的没有看到一直吗?
private void button1_Click(object sender, EventArgs e)
{
Random r = new Random();
label1.Text = r.Next(0, 9).ToString();
label2.Text = r.Next(0, 9).ToString();
label3.Text = r.Next(0, 9).ToString();
}
补充:.NET技术 , C#