using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Checkers_Game { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button101_Click(object sender, EventArgs e) { button1.Text = "X"; button3.Text = "X"; button5.Text = "X"; button8.Text = "X"; button10.Text = "X"; button12.Text = "X"; button25.Text = "O"; button27.Text = "O"; button29.Text = "O"; button32.Text = "O"; button34.Text = "O"; button36.Text = "O"; button101.Enabled = false; button102.Enabled = false; } private void button102_Click(object sender, EventArgs e) { button2.Text = "X"; button4.Text = "X"; button6.Text = "X"; button7.Text = "X"; button9.Text = "X"; button11.Text = "X"; button26.Text = "O"; button28.Text = "O"; button30.Text = "O"; button31.Text = "O"; button33.Text = "O"; button35.Text = "O"; button101.Enabled = false; button102.Enabled = false; } private void quitterToolStripMenuItem_Click(object sender, EventArgs e) { Application.Exit(); } private void nouvellePartieToolStripMenuItem_Click(object sender, EventArgs e) { button101.Enabled = true; button102.Enabled = true; button1.Text = ""; button2.Text = ""; button3.Text = ""; button4.Text = ""; button5.Text = ""; button6.Text = ""; button7.Text = ""; button8.Text = ""; button9.Text = ""; button10.Text = ""; button11.Text = ""; button12.Text = ""; button13.Text = ""; button14.Text = ""; button15.Text = ""; button16.Text = ""; button17.Text = ""; button18.Text = ""; button19.Text = ""; button20.Text = ""; button21.Text = ""; button22.Text = ""; button23.Text = ""; button24.Text = ""; button25.Text = ""; button26.Text = ""; button27.Text = ""; button28.Text = ""; button29.Text = ""; button30.Text = ""; button31.Text = ""; button32.Text = ""; button33.Text = ""; button34.Text = ""; button35.Text = ""; button36.Text = ""; } //déplacement possible pour le pion dans le bouton 1 private void button1_Click(object sender, EventArgs e) { if (button1.Text == "X" & button8.Text == "") { button8.BackColor = Color.Cyan; } } //déplacement possible pour le pion dans le bouton 3 private void button3_Click(object sender, EventArgs e) { if (button3.Text == "X" & button8.Text == "" & button10.Text=="") { button8.BackColor = Color.Cyan; button10.BackColor = Color.Cyan; } } private void button8_Click_1(object sender, EventArgs e) { //déplacement du pion du bouton 1 au 8 ( en diagonale) if (button8.Text == ""& button1.Text=="X") { button8.BackColor = Color.Red; button8.Text = "X"; button1.Text = ""; } //déplacement du pion du bouton 3 au 8 ( en diagonale) if (button8.Text == "" & button3.Text == "") { button8.BackColor = Color.Red; button8.Text = "X"; button3.Text = ""; } } private void button10_Click(object sender, EventArgs e) { //déplacement du pion du bouton 3 au 10 ( en diagonale) if (button10.Text == "" & button3.Text == "") { button10.BackColor = Color.Red; button10.Text = "X"; button3.Text = ""; } } } } //MessageBox.Show("mouvement non autorisé", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Warning);