PictureBox
The PictureBox control displays an Image object. The Image object to be displayed can be a member of, or descended from, one of the following classes:
- Bitmap
Contains pixel data for an image and its attributes. Typical file types are jpg, gif, or bmp.
- Icon
A small, transparent bitmap used to represent an object. The typical file extension is ico.
- Metafile
Contains records that describe a sequence of graphics operations. The typical file extension is wmf.
The PictureBox is a relatively simple control, with only three commonly used properties other than those inherited from Control or other base classes. The properties are listed in Table 13-8. The important property is SizeMode, which controls how the image is fit to the PictureBox.
Table 13-8. PictureBox properties
Property |
Value type |
Description |
---|---|---|
BorderStyle |
BorderStyle |
Read/write. Valid values are members of the BorderStyle enumeration, listed in Table 13-9. The default value is BorderStyle.None. |
Image |
Image |
Read/write. The image to display in the control. |
SizeMode |
PictureBoxSizeMode |
Read/write. How the image is displayed. Valid values are members of the PictureBoxSizeMode enumeration, listed in Table 13-10. The default value is PictureBoxSizeMode.Normal. |
Table 13-9. BorderStyle enumeration values
Value |
Description |
---|---|
Fixed3D |
3-D border. |
FixedSingle |
Single line border. |
None |
No border. |
Table 13-10. PictureBoxSizeMode enumeration values
Value |
Description |
---|---|
AutoSize |
The PictureBox is automatically sized to ... |
Get Programming .NET Windows Applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.