Example #1
0
        public void Draw(Graphics g)
        {
            g.TranslateTransform(100, 100);

            g.DrawRectangle(_borderPen, 0, 0, _game.NumberOfColumns * CellSize, _game.NumberOfRows * CellSize);

            for (int column = 1; column < _game.NumberOfColumns; column++)
            {
                g.DrawLine(Pens.Black, column * CellSize, 0, column * CellSize, _game.NumberOfRows * CellSize);
            }

            for (int row = 1; row < _game.NumberOfRows; row++)
            {
                g.DrawLine(Pens.Black, 0, row * CellSize, _game.NumberOfColumns * CellSize, row * CellSize);
            }

            for (int column = 0; column < _game.NumberOfColumns; column++)
            {
                for (int row = 0; row < _game.NumberOfRows; row++)
                {
                    DrawSymbol(g, _game.CellContents(column, row), column, row, Brushes.Black);
                }
            }
        }