Esempio n. 1
0
 public MazeDrawer(Graphics graphics, Maze maze, int cellSize)
 {
     this.graphics = graphics;
      this.maze = maze;
      cellWidth = cellSize;
      currentPoint = new Point(cellWidth, cellWidth);
 }
Esempio n. 2
0
 private void drawButton_Click(object sender, System.EventArgs e)
 {
     maze = MazeGenerator.Generate((int) mazeWidthNumeric.Value, (int) mazeHeightNumeric.Value);
      var mazeForm = new MazeForm(maze, (int)cellSizeNumeric.Value);
      mazeBitmap = mazeForm.ShowAndReturnBitmap();
      mazeHasBeenDrawn = true;
 }
Esempio n. 3
0
        public MazeForm(Maze maze, int cellSize)
        {
            InitializeComponent();

             this.maze = maze;
             this.cellSize = cellSize;

             Controls.Clear();

             var imageBox = new ImageBox
             {
            Width = cellSize * maze.Width,
            Height = cellSize * maze.Height
             };
             imageBox.Paint += OnPaint;
             Controls.Add(imageBox);

             mazeBitmap = new Bitmap(imageBox.Width, imageBox.Height);
             imageBox.DrawToBitmap(mazeBitmap, new Rectangle(0, 0, imageBox.Width, imageBox.Height));
        }