public void _Time(object sender, EventArgs e) { if (!a.Move()) { a = new Shape(panel1, label1, label2, button2); a.Creat(rn.Next(7)); } }
private void button1_Click(object sender, EventArgs e) { label3.Visible = false; label4.Visible = false; button1.Visible = false; textBox1.Visible = false; label1.Visible = true; a = new Shape(panel1, label1, label2, button2); a.Creat(rn.Next(7)); TimerT = new Timer(); TimerT.Enabled = true; try { TimerT.Interval = int.Parse(textBox1.Text); } catch { TimerT.Interval = 400; } TimerT.Tick += new System.EventHandler(_Time); TimerT.Start(); }