PictureBox Control

The PictureBox control is used to display graphics on a form. It can display both.bmp and .2bp graphic files. The PictureBox control is similar to the Image control in that each can be used to display graphics in your application—each supports the bitmap graphic format. The PictureBox control, however, contains functionality which the Image control does not, for example, it supports graphics methods.

Note The PictureBox control cannot act as a container.

The PictureBox properties, methods, and events listed in the following table are supported.

Properties Methods Events
FontUnderline DrawLine Change
FontTransparent ScaleX Click
BackColor DrawCircle DblClick
BorderStyle (PictureBox) Cls KeyDown, KeyUp
DrawWidth DrawPicture KeyPress
FillColor ScaleY MouseDown, MouseUp
FillStyle DrawPoint MouseMove
FontBold Move
FontItalic Refresh
FontName TextHeight
FontSize TextWidth
FontStrikethru SetScale
ForeColor
Height
Left
Picture
ScaleHeight
ScaleLeft
ScaleMode
ScaleTop
ScaleWidth
Tag
Top
Width

Pictures can be loaded into the PictureBox control at design time by selecting the Picture property from the control's Properties window. When a picture is loaded into the PictureBox control, the control does not automatically resize to fit the picture.

By default, graphics are loaded into a picture box at their original size, meaning that if the graphic is larger than the control, the image will be clipped—the PictureBox control does not provide scroll bars. Unlike the Image control, the PictureBox control cannot stretch the image to fit the size of the control.

Unsupported Features

The PictureBox properties, methods, and events listed in the following table are not supported.

Properties Methods Events
Align Drag DragDrop
Appearance LinkExecute DragOver
AutoSize LinkPoke GotFocus
ClipControls LinkRequest LinkClose
Container LinkSend LinkError
CurrentX, CurrentY OLEDrag LinkNotify
DataChanged Point LinkOpen
DataField SetFocus LostFocus
DataSource ShowWhatsThis OLECompleteDrag
DragIcon ZOrder OLEDragDrop
DragMode OLEDragOver
DrawMode OLEGiveFeedback
DrawStyle OLESetData
Enabled OLEStartDrag
Font Paint
Hdc
HelpContextID
HWnd
Image
Index
LinkMode
LinkTimeout
LinkTopic
MouseIcon
MousePointer
Name
Negotiate
OLEDropMode
OLEDragMode
ToolTipText
Drag
LinkExecute
LinkPoke
LinkRequest
LinkSend
OLEDragMode
OLEDropMode
Palette
Parent
TabIndex
TabStop
ToolTipText
Visible
WhatsThisHelpID