/// <summary> /// Fills the grid and the direction panels /// </summary> private void FillPanel() { gridIm = new FormsCRGrid(side); // =====================direction part====================== DirPanel.Size = new Size(51 * side + 1, 51 * side + 1); DirPanel.Controls.Clear(); FillPicDir(); for (int i = 0; i < side; i++) { for (int j = 0; j < side; j++) { DirPanel.Controls.Add(picDir[i, j]); } } // =======================grid part========================= GridPanel.Size = new Size(51 * side + 1, 51 * side + 1); GridPanel.Controls.Clear(); FillPicGrid(); for (int i = 0; i < side; i++) { for (int j = 0; j < side; j++) { GridPanel.Controls.Add(picGrid[i, j]); } } DirPanel.BringToFront(); }
/// <summary> /// Fills the grid pictures array /// </summary> private void FillPicGrid() { picGrid = new PictureBox[side, side]; for (int i = 0; i < side; i++) { for (int j = 0; j < side; j++) { picGrid[i, j] = new PictureBox() { Size = new Size(50, 50), BorderStyle = BorderStyle.FixedSingle, Location = new Point(j * 51, i * 51), SizeMode = PictureBoxSizeMode.StretchImage, Image = i == 0 && j == 0 ? FormsCRGrid.GetGridImage(14, 0) : FormsCRGrid.GetGridImage(0, 0) }; } } }