The pictureboxes I create in this way sometimes overlap. how can i prevent it ?. I want a distance between each picture box. for example, a distance of at least 10px between pictureboxes.
int sayac = 0;
Random random = new Random();
while (sayac < 10)
{
PictureBox picture = new PictureBox();
picture.BackColor = Color.Blue;
picture.SizeMode = PictureBoxSizeMode.StretchImage;
picture.SetBounds(random.Next(621, 967), random.Next(56, 647), 100, 50);
this.Controls.Add(picture);
sayac++;
}
Aucun commentaire:
Enregistrer un commentaire