// create a new PictureBox control PictureBox picBox = new PictureBox(); // set the image to display picBox.Image = Image.FromFile(@"C:\image.jpg"); // hide the control picBox.Visible = false;
// create a new PictureBox control PictureBox picBox = new PictureBox(); // set the image to display picBox.Image = Image.FromFile(@"C:\image.jpg"); // set the size of the control picBox.Size = new Size(200, 200); // position the control on the form picBox.Location = new Point(50, 50);In this example, we again create a new PictureBox control and set the image to display. However, we also set the size of the control to 200x200 pixels and position it at the coordinates (50,50) on the form. The System.Windows.Forms library is the package that contains the PictureBox class.