Пример #1
0
        private GameSquare CreateSquare(int sizeX, int sizeY)
        {
            GameSquare gameSquare = new GameSquare();

            gameSquare.Width       = sizeX;
            gameSquare.Height      = sizeY;
            gameSquare.BorderStyle = BorderStyle.FixedSingle;
            return(gameSquare);
        }
Пример #2
0
        public void DrawGrid()
        {
            ClearGrid();
            int squareSizeX = this.Width / currentLevel.GetScale().X;
            int squareSizeY = this.Height / currentLevel.GetScale().Y;

            for (int x = 0; x < currentLevel.GetScale().X; x++)
            {
                List <GameSquare> gameSquareListX = new List <GameSquare>();
                for (int y = 0; y < currentLevel.GetScale().Y; y++)
                {
                    GameSquare square = CreateSquare(squareSizeX, squareSizeY);
                    square.Location = new Point(x * squareSizeX, y * squareSizeY);
                    this.Controls.Add(square);
                    gameSquareListX.Add(square);
                }
                gameSquares.Add(gameSquareListX);
            }
        }