Visual Basic Reference

Visual Studio 6.0

Picture Property (ActiveX Controls)

See Also   Example   Applies To

Returns or sets a graphic to be displayed in a control. For the OLE container control, not available at design time and read-only at run time.


object.Picture [= picture]

The Picture property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
picture A string expression specifying a file containing a graphic, as described in Settings.


The settings for picture are:

Setting Description
(None) (Default) No picture.
(Bitmap, icon, metafile) Specifies a graphic. You can load the graphic from the Properties window at design time. At run time, you can also set this property using the LoadPicture function on a bitmap, icon, or metafile.


At design time, you can transfer a graphic with the Clipboard using the Copy, Cut, and Paste commands on the Edit menu. At run time, you can use Clipboard methods such as GetData, SetData, and GetFormat with the nontext Clipboard constants vbCFBitmap, vbCFMetafile, and vbCFDIB, which are listed in the Visual Basic (VB) object library in the Object Browser.

When setting the Picture property at design time, the graphic is saved and loaded with the form. If you create an executable file, the file contains the image. When you load a graphic at run time, the graphic isn't saved with the application. Use the SavePicture statement to save a graphic from a form or picture box into a file.

Note   At run time, the Picture property can be set to any other object's DragIcon, Icon, Image, or Picture property, or you can assign it the graphic returned by the LoadPicture function. The exception to this is the Picture property of the ListImages object, which is a read-only property.