Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            _Pen = new Pen(Color.Gray);
            borders = 0;
            _Pen.Width = 5;
            gra = new Gra(s_X, s_Y, player_num);
            playerr = new Player[player_num];
            g = pictureBox1.CreateGraphics();
            pictureBox1.Enabled = true;
            int x, y;
            System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.White);
            g.FillRectangle(myBrush, new Rectangle(0, 0, 550, 550));
            myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
            for (int i = 0; i < s_X; i++)
            {
                for (int j = 0; j < s_Y; j++)
                {

                    x = s * i + 35;
                    y = s * j + 35;
                    _Pen = new Pen(Color.LightGray);
                    _Pen.Width = 10;
                    Point p0 = new Point(x, y);
                    Point px = new Point(x + s, y);
                    Point py = new Point(x, y + s);
                    if (i != s_X - 1) { g.DrawLine(_Pen, p0, px); }
                    if (j != s_Y - 1) { g.DrawLine(_Pen, p0, py); }
                    x = s * i + 27;
                    y = s * j + 27;
                    g.FillEllipse(myBrush, new Rectangle(x, y, 16, 16));
                }
            }
            c_pl_id = 0;
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            _Pen                = new Pen(Color.Gray);
            borders             = 0;
            _Pen.Width          = 5;
            gra                 = new Gra(s_X, s_Y, player_num);
            playerr             = new Player[player_num];
            g                   = pictureBox1.CreateGraphics();
            pictureBox1.Enabled = true;
            int x, y;

            System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.White);
            g.FillRectangle(myBrush, new Rectangle(0, 0, 550, 550));
            myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
            for (int i = 0; i < s_X; i++)
            {
                for (int j = 0; j < s_Y; j++)
                {
                    x          = s * i + 35;
                    y          = s * j + 35;
                    _Pen       = new Pen(Color.LightGray);
                    _Pen.Width = 10;
                    Point p0 = new Point(x, y);
                    Point px = new Point(x + s, y);
                    Point py = new Point(x, y + s);
                    if (i != s_X - 1)
                    {
                        g.DrawLine(_Pen, p0, px);
                    }
                    if (j != s_Y - 1)
                    {
                        g.DrawLine(_Pen, p0, py);
                    }
                    x = s * i + 27;
                    y = s * j + 27;
                    g.FillEllipse(myBrush, new Rectangle(x, y, 16, 16));
                }
            }
            c_pl_id = 0;
        }