// create a new picture box PictureBox myPictureBox = new PictureBox(); // set its image property myPictureBox.Image = Image.FromFile("image.jpg"); // add it to the form's controls this.Controls.Add(myPictureBox); // bring the picture box to the front myPictureBox.BringToFront();
// loop through all picture boxes in the form foreach (PictureBox pictureBox in this.Controls.OfTypeThis example uses the OfType method to get all picture boxes in the form, and then loops through each one and brings it to the front. The System.Windows.Forms namespace is part of the .NET Framework Class Library.()) { // bring each picture box to the front pictureBox.BringToFront(); }