Ejemplo n.º 1
0
        private void picBoard_Paint(object sender, PaintEventArgs e)
        {
            var board                 = game.GetBoard();
            var boardSize             = new Size(board.GetLength(1), board.GetLength(0));
            var boardCharacter        = game.GetBoardCharacter();
            var boardFreezedCharacter = game.GetBoardFreezedCharacter();

            for (int y = 0; y < boardSize.Height; y++)
            {
                for (int x = 0; x < boardSize.Width; x++)
                {
                    if (board[y, x] == boardCharacter)
                    {
                        continue;
                    }
                    var location     = new Point(x * 10, y * 10);
                    var blockElement = new Rectangle(location, blockElementSize);
                    if (board[y, x] == boardFreezedCharacter)
                    {
                        e.Graphics.FillRectangle(freezedBlockColor, blockElement);
                    }
                    else
                    {
                        e.Graphics.FillRectangle(activeBlockColor, blockElement);
                    }
                }
            }
        }