예제 #1
0
        private void DrawGrid()
        {
            int index = 0;

            // Set the colors of the rectangles
            for (int r = 0; r < gameLogic.NumCells; r++)
            {
                for (int c = 0; c < gameLogic.NumCells; c++)
                {
                    Rectangle rect = boardCanvas.Children[index] as Rectangle;
                    index++;

                    if (gameLogic.GetGridValue(r, c))
                    {
                        // On
                        rect.Fill   = Brushes.White;
                        rect.Stroke = Brushes.Black;
                    }
                    else
                    {
                        // Off
                        rect.Fill   = Brushes.Black;
                        rect.Stroke = Brushes.White;
                    }
                }
            }
        }
예제 #2
0
        private void DrawGrid()
        {
            int index = 0;

            // Set the colors of the rectangles
            for (int r = 0; r < game.GridSize; r++)
            {
                for (int c = 0; c < game.GridSize; c++)
                {
                    Rectangle rect = boardCanvas.Children[index] as Rectangle;
                    index++;

                    if (game.GetGridValue(r, c))
                    {
                        // On
                        rect.Fill   = Brushes.Navy;
                        rect.Stroke = Brushes.DarkRed;
                    }
                    else
                    {
                        // Off
                        rect.Fill   = Brushes.DarkRed;
                        rect.Stroke = Brushes.Navy;
                    }
                }
            }
        }