Image Property

See Also29YUVVR                 Example1N6N9HT>Low

Applies To

Form14TJ2LN, picture box31MYIWX.

Description

Specifies a handle164OMS7 to a persistent bitmap41CTZFK; the handle is provided by the system.  Not available at design time; read-only at run time.

Usage

[form.][picturebox.]Image

Remarks

This property is a Microsoft Windows environment bitmap handle.

An object's AutoRedraw1UY7ZM3 property determines whether the repainting of an object occurs with a persistent bitmap or through Paint25UTDKO events.  The operating environment identifies an object's persistent bitmap by assigning a handle to it; you can use the Image property to get this handle.

An Image value exists regardless of the setting for AutoRedraw.  If AutoRedraw is True and nothing has been drawn, the image contains only the color set with the BackColor1W9T6JQ property and the picture.

You can assign the value of Image to the Picture4GBE5Q property.  The Image property also provides a value to pass to Windows APIDEFAPI calls.

The Image, DragIcon3G3M07O, and Picture properties must be used directly when assigning values to other properties, when saving with the SavePicture2U07NJP statement, or when placing something onto the ClipboardW4LZLB.  You cannot assign these to temporary variables and then use the results.

The AutoRedraw property can cause Image, which is a handle to a bitmap, to change.  When AutoRedraw is True, an object's hDCZVPW3G property becomes a handle to a device context64FX9YH that contains the Image bitmap.

Data Type

IntegerDOKXHY


See Also

Help:

AutoRedraw Property1UY7ZM3

BackColor Property1W9T6JQ

DragIcon Property3G3M07O

Paint Event25UTDKO

Picture Property4GBE5Q

SavePicture Statement2U07NJP

 

Programmer's Guide:

Chapter 16, "Displaying and Printing Information"


Image Property Example

The example draws a circle in the first picture box each time you click it.  When you click the second picture box, the picture from the first picture box is copied into it.  To try this example, paste the code into the Declarations section of a form that has two large, equal-sized picture box controls.  Press F5 to run the program and then click the picture box controls.

Form_Load ()
  Picture1.AutoReDraw = True               ' Set AutoRedraw True.
End Sub


Sub Picture1_Click ()
  Dim PW, PH                               ' Declare variables.
  Picture1.FillStyle = 0                   ' Set FillStyle to solid.
  Picture1.FillColor = QBColor(Int(Rnd * 15))  ' Choose random color.
  PW = Picture1.ScaleWidth                 ' Set ScaleWidth.
  PH = Picture1.ScaleHeight                ' Set ScaleHeight.
  ' Draw a circle in random location.
  Picture1.Circle (Int(Rnd * PW), Int(Rnd * PH)), 250
End Sub


Sub Picture2_Click ()
  Picture2.Picture = Picture1.Image        ' Copy Image to Picture2.
End Sub