Exemplo n.º 1
0
        public void DrawBoardFields()
        {
            Graphics g        = form.CreateGraphics();
            Coord    startPos = this.TopLeft;

            for (int x = (int)this.TopLeft.X - this.Margin; x <= this.BottomRight.X + this.Margin; x++)
            {
                for (int y = (int)this.TopLeft.Y - this.Margin; y <= this.BottomRight.Y + this.Margin; y++)
                {
                    if ((x <= this.BottomRight.X && y <= this.BottomRight.Y) &&
                        (x >= (int)this.TopLeft.X && y >= (int)this.TopLeft.Y))
                    {
                        g.FillRectangle(Brushes.GhostWhite, startPos.X, startPos.Y, CellSize, CellSize);
                    }

                    g.DrawRectangle(new Pen(Brushes.White), startPos.X, startPos.Y, CellSize, CellSize);

                    startPos.ChangeToDown(CellSize);
                }

                startPos.Y = 0;
                startPos.ChangeToRight(CellSize);
            }
        }