PictureBox[] p = new PictureBox[15];
for (int i = 0; i == 15; i++)
{
p[i] = new PictureBox();
p[i].Name = "ItemNum" + i.ToString();
p[i].Location = new Point(0, 0);
p[i].Size = new Size(10, 10);
p[i].Visible = true;
p[i].BackColor = Color.Red;
this.Controls.Add(p[i]);
}
i couldnt make Location.How should i write?How can i enhance the top and lef of the location for each picturebox
for (int i = 0; i < 16; i++)
{
PictureBox p = new PictureBox();
p.Location = new Point(10, (i + 1) * 20);
p.Size = new Size(10, 10);
p.BorderStyle = BorderStyle.FixedSingle;
groupBox1.Controls.Add(p);
}
Use the above code after
InitializeComponent();
in your Form constructor.