private void FormMain_Load(object sender, EventArgs e) { DataGridViewUtils.InitGridForArr(dgvMatrix, 30, false, true, true, true, true); Bitmap = new Bitmap(pictureBox.Width, pictureBox.Height); Map = Graphics.FromImage(Bitmap); Drawing = false; }
private void buttonExample1_Click(object sender, EventArgs e) { int[,] ex1 = { { 0, 1, 0, 0, 0 }, { 1, 0, 1, 0, 0 }, { 0, 1, 0, 0, 0 }, { 0, 0, 0, 0, 1 }, { 0, 0, 0, 1, 0 } }; DataGridViewUtils.Array2ToGrid <int>(dgvMatrix, ex1); textBoxEntrance.Text = "1 4"; textBoxExit.Text = "3 5"; }
private void button1_Click(object sender, EventArgs e) { Labirint = new Graf(DataGridViewUtils.GridToArray2 <int>(dgvMatrix), ArrayUtils.StrToInt(textBoxEntrance.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)), ArrayUtils.StrToInt(textBoxExit.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))); DrawingGraf = new Draw(Map, Labirint); DrawingGraf.DrawGraf(); Node = Labirint.Nodes; Path = Labirint.Path; graphicsContainer = Map.BeginContainer(); pictureBox.Image = Bitmap; }