PictureButton (statement)


PictureButton X,Y,width,height,PictureName$,PictureType [,.Identifier]


Creates a picture button control in a dialog box template.


Picture button controls behave very much like a push button controls. Visually, picture buttons are different than push buttons in that they contain a graphic image imported either from a file or from a picture library.

The PictureButton statement accepts the following parameters:





X, Y

Integer coordinates specifying the position of the control (in dialog units) relative to the upper left corner of the dialog box.


width, height

Integer coordinates specifying the dimensions of the control in dialog units.



String containing the name of the picture. If PictureType is 0, then this name specifies the name of the file containing the image. If PictureType is 10, then PictureName$ specifies the name of the image within the resource of the picture library.

If PictureName$ is empty, then no picture will be associated with the control. A picture can later be placed into the picture control using the DlgSetPicture statement.



Integer specifying the source for the image. The following sources are supported:




The image is contained in a file on disk.




The image is contained in a picture library as specified by the PicName$ parameter on the Begin Dialog statement.



Name by which this control can be referenced by statements in a dialog function (such as DlgFocus and DlgEnable).


The picture button control extracts the actual image from either a disk file or a picture library, depending on the value of PictureType. The supported picture formats vary from platform to platform.

If PictureName$ is a zero-length string, then the picture is removed from the picture button control, freeing any memory associated with that picture.

Example 1

This first example shows how to use a picture from a file.

Sub Main()
  Begin Dialog LogoDialogTemplate 16,32,288,76,"Introduction"
    OKButton 240,8,40,14
    PictureButton 8,4,224,64,"c:\bitmaps\logo.bmp",0,.Logo
  End Dialog
  Dim LogoDialog As LogoDialogTemplate
  Dialog LogoDialog
End Sub

Example 2

This second example shows how to use a picture from a picture library.

Sub Main()
  Begin Dialog LogoDialogTemplate 16,31,288,76,"Introduction",,"pictures.dll"
    OKButton 240,8,40,14
    PictureButton 8,4,224,64,"CompanyLogo",10,.Logo
  End Dialog
  Dim LogoDialog As LogoDialogTemplate
  Dialog LogoDialog
End Sub

See Also

CancelButton (statement); CheckBox (statement); ComboBox (statement); Dialog (function); Dialog (statement); DropListBox (statement); GroupBox (statement); ListBox (statement); OKButton (statement); OptionButton (statement); OptionGroup (statement); PushButton (statement); Text (statement); TextBox (statement); Begin Dialog (statement), Picture (statement); DlgSetPicture (statement).


Picture controls can contain either a bitmap or a WMF (Windows metafile). When extracting images from a picture library, the Basic Control Engine assumes that the resource type for metafiles is 256.

Picture libraries are implemented as DLLs on the Win32 platforms.

Picture controls can contain either bitmaps or Windows metafiles.

More information