private void DrawMaze(Maze maze, Graphics graphics, ImageSizes sizes) { Pen pen = new Pen(Color.White, 2); float currentPositionX = sizes.MarginX; float currentPositionY = sizes.MarginY; float width = sizes.CellWidth; float height = sizes.CellHeight; for (int i = 0; i < maze.Length; i++) { currentPositionY = sizes.MarginY; for (int j = 0; j < maze[i].Length; j++) { MazeCell currentCell = maze[i][j]; if (currentCell.HasWall(MazeWall.Bottom)) { graphics.DrawLine(pen, currentPositionX, currentPositionY, currentPositionX + width, currentPositionY); } if (currentCell.HasWall(MazeWall.Right)) { graphics.DrawLine(pen, currentPositionX + width, currentPositionY, currentPositionX + width, currentPositionY + height); } if (currentCell.HasWall(MazeWall.Top)) { graphics.DrawLine(pen, currentPositionX + width, currentPositionY + height, currentPositionX, currentPositionY + height); } if (currentCell.HasWall(MazeWall.Left)) { graphics.DrawLine(pen, currentPositionX, currentPositionY + height, currentPositionX, currentPositionY); } currentPositionY += sizes.CellHeight; } currentPositionX += sizes.CellWidth; } }