Like most controls and as we described in our introduction to control design, to get a picture box, from the Toolbox, you can click the PictureBox button and click the form. To programmatically get the control, you can create a handle to the PictureBox class. Before using the control, make sure you add it to the list of Controls of the form that will host it.-->
With the Windows Forms PictureBox control, you can load and display a picture on a form at design time by setting the Image property to a valid picture. The following table shows the acceptable file types.
|Type||File name extension|
To display a picture at design time
Draw a PictureBox control on a form.
In the Properties window, select the Image property, then select the ellipsis button to display the Open dialog box.
If you're looking for a specific file type (for example, .gif files), select it in the Files of type box.
Select the file you want to display.
To clear the picture at design time
- In the Properties window, select the Image property. Right-click the small thumbnail image that appears to the left of the name of the image object, and then choose Reset.