private void PlayButton_Click(object sender, EventArgs e) { //reset timer1.Stop(); timer2.Stop(); tempQ.Clear(); foreach (PictureBox item in DISC) { item.Visible = false; } time = new TimeSpan(0); label4.Text = "Thời gian chơi 00:00:00"; move = 0; label5.Text = "Số bước đi : 0"; label7.Text = "trên 0"; RodA.Clear(); RodB.Clear(); RodC.Clear(); ABoxPic.BackColor = BBoxPic.BackColor = CBoxPic.BackColor = System.Drawing.Color.Gray; FirstSelect = SecondSelect = null; //play Level.Enabled = false; GiveUpButton.Enabled = true; MinMove(Level.Value); PlayButton.Text = "Chơi Lại"; int y = FirstY, x = ABoxPic.Location.X + (9 - (int)Level.Value) * 10; for (int i = (int)Level.Value - 1; i >= 0; i--, x += XFormAtoB, y -= DiscHeight) { DISC[i].Location = new Point(x, y); DISC[i].Visible = true; RodA.Push(DISC[i]); } timer1.Start(); }
private void Pic1_Click(object sender, EventArgs e) { PictureBox temp = sender as PictureBox; if (RodA.Contains(temp)) { ABoxPic_Click(ABoxPic, new EventArgs()); } if (RodB.Contains(temp)) { ABoxPic_Click(BBoxPic, new EventArgs()); } if (RodC.Contains(temp)) { ABoxPic_Click(CBoxPic, new EventArgs()); } }