Picture Property

Visual Studio .NET 2003

Specifies an image to display on a control. Available at design time and run time.

Control.Picture [ = cFileName ]


Character data type. The cFileName parameter specifies the name of a graphics file.

Visual FoxPro supports all graphics file formats handled by Graphics Device Interface+ (GDI+). For details about valid graphics file formats, see Graphics Support in Visual FoxPro.


Images display centered on the control.

For CommandButton and OptionButton controls, the specified image is used whether a button is available, selected, or unavailable. You can specify a different image for each button state by setting the DownPicture and DisabledPicture properties.

To display the image for CommandButton, CheckBox, and OptionButton controls, you need to set the following Style property values for the corresponding control.

Control Style property setting
CommandButton 0 (Standard)
CheckBox, OptionButton 1 (Graphical)

For Header objects, if the header does not contain a caption, the image appears in the center of the header. If the header contains a caption, the Header Alignment property determines how the image aligns with caption text. If Header Alignment is set to left or center, the image appears to the right of the caption. If Alignment is set to right, the image appears to the left of the caption.

For Toolbars, the recommended image dimensions are 16 x 15 pixels (width x height).

For ComboBox and ListBox controls, you can use the Picture property as single-value property or as an array. If you use Picture as a single-value property, all items in the control show the same image. If you use Picture as an array, which stores an image for each item in the list, each item can have a different image. For example:

oCombobox.AddItem("Web Services")
oCombobox.Picture[1] = 'home.bmp'
oCombobox.Picture[2] = 'community.bmp'
oCombobox.Picture[3] = 'websvc.bmp'
Note   If you set the Picture property at design time, and the file you specify does not exist, Visual FoxPro displays the appropriate message, but the property remains set to the file you specified. Visual FoxPro disregards the Picture property at run time if it is set to a file that does not exist.

Visual FoxPro supports animated .gif files for the Picture property only on an Image control.

See Also

DisabledPicture Property | DownPicture Property | Style Property | Adding Pictures to Items in a List

Applies To: CheckBox Control | CommandButton Control | ComboBox Control | Container Object | Control Object | Custom Object | Form Object | Header Object | Image Control | ListBox Control | OptionButton Control | Page Object | _SCREEN System Variable |