OnPicture Property (ASwitch)

Returns or sets the Picture object for the object when it is in the On state. This property only applies to User Defined switches or buttons.

Syntax

Object.OnPicture [ = picOnPicture ]

The OnPicture property syntax has the following parts:

 

Name

Type

Description

Object

ASwitch

ASwitch control

picOnPicture

APicture

A string expression specifying a file containing a graphic

Comments

This property only applies to the following switch styles: User Defined Vertical Switch, User Defined Horizontal Button, and User Defined Button.

At design time: A graphic can be loaded with the Clipboard Copy, Cut, and Paste commands. When setting the OnPicture property, the graphic is saved and loaded with the form. If an executable file is created, the file contains the image.

At run time: A graphic can be loaded using the Clipboard methods such as GetData, SetData, and GetFormat with the nontext Clipboard constants ACFBitmap, ACFMetafile, and ACFDIB, which are listed in the object library in the Object Browser. When a graphic is loaded 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 OnPicture property can be set to any other object's DragIcon, Icon, Image, or Picture property, or the graphic can be assigned by the return of the LoadPicture function. The exception to this is the Picture property of the ListImages object, which is a read-only property.

A picture can also be used as the background with text over it for some attractive combinations.

Example

The following statement changes the ASwitch's OnPicture to a given image file:

sw1.OnPicture= LoadPicture ("c:\dirname\filename.bmp")

Applies to

ASwitch

See Also

OffPicture, OffPictureColor, OnPictureColor, Style