Reputation: 63
I'm adding controls onto my form in location specified by their position in array. I've tried switching panels to buttons but controls still aren't showing.
int[,] gamefield = new int[9, 8];
Panel[,] vis_gamefield = new Panel[9, 8];
private void Real_Move(int col)
{
for (int i = 6; i > 0; i--)
{
gamefield[col, i] = 1;
vis_gamefield[col, i] = new Panel();
vis_gamefield[col, i].Name = "Panel" + moves;
vis_gamefield[col, i].BackColor = Color.Red;
vis_gamefield[col, i].Size = new Size(88, 88);
vis_gamefield[col, i].Location = new Point(158 + 100 * (i - 1), 174 + 99 * (col - 1));
vis_gamefield[col, i].Visible = true;
vis_gamefield[col, i].BringToFront();
vis_gamefield[col, i].Show();
Win_Check(col, i);
moves++;
break;
}
}
Upvotes: 0
Views: 66
Reputation: 56
it is kinda unclear how exactly do you add vis_gamefield to the forms Controls collection?
Do you have a line that says something like this.Controls.Add(vis_gamefield);
in the Form constructor?
it should look something like below code
public Form1()
{
InitializeComponent();
this.Controls.Add(vis_gamefield);
}
Upvotes: 2