1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
   |  
 
private struct Struct_Position
        {
            public int x;
            public int y;
        }
 
 
 
        //private Button[,] tab_btnJeu;
        private PictureBox[,] tab_btnJeu =new PictureBox[8,8];
        private Button btnMonBouton;
 
        //Variables de couleurs
        public Color Couleur1 = Color.Wheat;
        public Color Couleur2 = Color.Green;
        public Color CouleurPrincipal = Color.Turquoise;
        public bool blnBlancJoue = true; 
 
 private void Intitialise()
        {
            int i;
            int j;
 
            for (i = 0; i < 8; i++)
            {
                for (j = 8; j < 8; j++)
                {
 
 
                    tab_btnJeu[i, j].BackColor = CouleurPrincipal;
 
 
 
                }
            }
        }
 
private void Reversi_Load(object sender, EventArgs e)
        {
            Intitialise();
            int x, y;
 
            //remplissage du tableau de boutons
            for (x = 0; x < 8; x++)
            {
                for (y = 0; y < 8; y++)
                {
                    //initialise le bouton
 
                    tab_btnJeu[x, y]= new PictureBox();
 
 
 
 
                    //caractéristiques du bouton
                    tab_btnJeu[x, y].Size = new Size(48, 48);
                    tab_btnJeu[x, y].Top = y * 48;
                    tab_btnJeu[x, y].Left = x * 48;
 
                    tab_btnJeu[x, y].ForeColor = Color.Red;
                    tab_btnJeu[x, y].BackColor = CouleurPrincipal;
 
                    //prépare la gestion du click sur le bouton
                    tab_btnJeu[x, y].MouseUp += new System.Windows.Forms.MouseEventHandler(this.Verifie_Clique);
 
 
 
                    //dessine le bouton dans le panel
                    this.panel1.Controls.Add(tab_btnJeu[x, y]);
                }
            }
 
 
 
            //appelle la procédure qui colorie les 4 boutons du centre
            Colorier();
 
} | 
Partager