I use the panel in winforms C # and fill the panel with a drawer without an image using a loop
For example, the panel name is Panama.
foreach (string s in fileNames)
{
PictureBox pbox = new new PictureBox();
pBox.Image = Image.FromFile(s);
pbox.Location = new point(10,15);
.
.
.
.
this.panal.Controls.Add(pBox);
}
Now I want to change the location of the image window in another method. The problem is that now I can access the images to change their location. I am trying to use the following, but this is not a success.
foreach (Control p in panal.Controls)
if (p.GetType == PictureBox)
p.Location.X = 50;
But there is a mistake. Mistake:
System.Windows.Forms.PictureBox' is a 'type' but is used like a 'variable'
source
share