private void CreatePanel(int pos, Panel[,] panel) { for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { Panel cell = new MyPanel(); cell.Size = new Size(47, 46); cell.BackColor = System.Drawing.Color.Transparent; cell.BackgroundImageLayout = ImageLayout.Stretch; cell.MouseEnter += new EventHandler(Panel_Hover); cell.MouseClick += new MouseEventHandler(Panel_Click); cell.Location = new Point(pos + ((47 + 1) * i), 48 + ((46 + 1) * j)); panel[i, j] = cell; this.Controls.Add(cell); } } }
private void CreatePanel(int iRow, int iColumn) { for (int i = 0; i < iRow; i++) { for (int j = 0; j < iColumn; j++) { Panel cell = new MyPanel(); cell.Size = new Size(34, 34); cell.BackColor = System.Drawing.Color.Transparent; cell.BackgroundImageLayout = ImageLayout.Stretch; if (iRow == 10) { cell.Location = new Point(365 + (35 * i), -3 + (35 * j)); Field[i, j] = cell; } else { cell.Location = new Point(822 + (35 * i), 36 + (35 * j)); Next[i, j] = cell; } this.Controls.Add(cell); } } }