public partial class Maze Form private Stream fileStream private int m

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
public partial class Maze : Form
{
private Stream fileStream;
private int[,] matrix;
private int N;
private int M;
private Bitmap map;
private Graphics canvas;
public Maze()
{
InitializeComponent();
}
private void browseFile_Click(object sender, EventArgs e)
{
fileStream = FileWork.BrowseFile();
comboBox.SelectedItem = null;
}
private void startBtn_Click(object sender, EventArgs e)
{
try
{
map = new Bitmap(canvasBox.Size.Width, canvasBox.Size.Height);
canvas = Graphics.FromImage(map);
FileWork.GetSize(fileStream, out N, out M);
matrix = FileWork.SaveMatrix(fileStream, N, M);
Draw draw = new Draw(matrix, canvas, canvasBox.Width, canvasBox.Height, N, M);
draw.DrawGrid();
draw.BreakWalls();
canvasBox.Image = map;
canvas.Dispose();
fileStream.Dispose();
}
catch{}
}
}