Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            table = new int[8, 8]
            {
                { 02, 03, 04, 05, 06, 04, 03, 02 },
                { 01, 01, 01, 01, 01, 01, 01, 01 },
                { 00, 00, 00, 00, 00, 00, 00, 00 },
                { 00, 00, 00, 00, 00, 00, 00, 00 },
                { 00, 00, 11, 00, 00, 00, 00, 00 },
                { 00, 00, 00, 00, 00, 00, 00, 00 },
                { 11, 11, 11, 11, 11, 11, 11, 11 },
                { 12, 13, 14, 15, 16, 14, 13, 12 },
            };
            bt = new uC[8, 8];
            go = new int[8, 8];


            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    bt[i, j]          = new uC();
                    bt[i, j].Parent   = this;
                    bt[i, j].Location = new Point(j * 50 + 50, i * 50 + 50);
                    bt[i, j].pozX     = j;
                    bt[i, j].pozY     = i;
                    bt[i, j].Size     = new Size(50, 50);
                    bt[i, j].Click   += new EventHandler(uC_Click);
                    if (i % 2 == 0)
                    {
                        if (j % 2 == 1)
                        {
                            bt[i, j].BackColor = Color.Black;
                        }
                        else
                        {
                            bt[i, j].BackColor = Color.White;
                        }
                    }
                    else
                    if (j % 2 == 1)
                    {
                        bt[i, j].BackColor = Color.White;
                    }
                    else
                    {
                        bt[i, j].BackColor = Color.Black;
                    }
                    bt[i, j].BackgroundImageLayout = ImageLayout.Center;
                }
            }
            validate();
            drawing();
        }
Esempio n. 2
0
        private void buttonStart(object sender, EventArgs e)
        {
            //First Number : 0 -> Black , 1 -> White
            //Second Number :
            // 1 -> sarbaz
            // 2 -> rokh
            // 3 -> asb
            // 4 -> fil
            // 5 -> vazir
            // 6 -> shah
            table = new int[8, 8]      //Init Table with Pieces
            {
                { 02, 03, 04, 05, 06, 04, 03, 02 },
                { 01, 01, 01, 01, 01, 01, 01, 01 },
                { 00, 00, 00, 00, 00, 00, 00, 00 },
                { 00, 00, 00, 00, 00, 00, 00, 00 },
                { 00, 00, 00, 00, 00, 00, 00, 00 },
                { 00, 00, 00, 00, 00, 00, 00, 00 },
                { 11, 11, 11, 11, 11, 11, 11, 11 },
                { 12, 13, 14, 15, 16, 14, 13, 12 },
            };
            bt = new uC[8, 8];
            go = new int[8, 8];


            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    bt[i, j]          = new uC();
                    bt[i, j].Parent   = this;
                    bt[i, j].Location = new Point(j * 50 + 50, i * 50 + 50);
                    bt[i, j].pozX     = j;
                    bt[i, j].pozY     = i;
                    bt[i, j].Size     = new Size(50, 50);
                    bt[i, j].Click   += new EventHandler(uC_Click);
                    if (i % 2 == 0)
                    {
                        if (j % 2 == 1)
                        {
                            bt[i, j].BackColor = Color.Black;
                        }
                        else
                        {
                            bt[i, j].BackColor = Color.White;
                        }
                    }
                    else
                    if (j % 2 == 1)
                    {
                        bt[i, j].BackColor = Color.White;
                    }
                    else
                    {
                        bt[i, j].BackColor = Color.Black;
                    }
                    bt[i, j].BackgroundImageLayout = ImageLayout.Center;
                }
            }

            validate();
            drawing();
        }