To solve my problem i used the Sanjudson tip like below:
private void inserindoMaisdeUmaImagemPictureBox(string caminhoImagem, int coordX, int coordY, int numeroImagens)
{
int horizontalX = coordX;
int verticalY = coordY;
if (caminhoImagem != "")
{
for (int i = 0; i < numeroImagens; i++)
{
PictureBox PicBoxSeres = new PictureBox();
horizontalX = this.RandomSerArtificial.Next(this.panelViveiro.Si ze.Width);
verticalY = this.RandomSerArtificial.Next(this.panelViveiro.Si ze.Height);
PicBoxSeres.Image = Image.FromFile(caminhoImagem);
PicBoxSeres.Location = new System.Drawing.Point(horizontalX, verticalY);
PicBoxList.Add(PicBoxSeres);
}
foreach (PictureBox listaSeres in PicBoxList)
{
this.panelViveiro.Controls.Add(listaSeres);
}
}//final do if
|