Draws the contents of a graphics file on an object.
Object.PaintPicture ( pic, fXDest, fYDest [, fWidthDest] [, fHeightDest] [, fXSrc]
[, fYSrc] [, fWidthSrc] [, fHeightSrc] [, enPictureDrawMode ] )
The PaintPicture method syntax has the following parts:
Name |
Type |
Description |
Object |
AForm |
AForm object |
pic |
Val APicture |
A string expression specifying a file containing a graphic to be drawn onto the object. This must be the Picture property of a Form or PictureBox. |
fXDest |
Val Float |
The destination horizontal coordinate (x-axis) on the object for the picture to be drawn. The ScaleMode property of the object determines the unit of measure used. |
fYDest |
Val Float |
The destination vertical coordinate (y-axis) on the object for the picture to be drawn. The ScaleMode property of the object determines the unit of measure used. |
fWidthDest |
Val Variant |
The destination width of the picture. The ScaleMode property of the object determines the unit of measure used. If the destination width is larger or smaller than the source width (fWidthSrc), picture is stretched or compressed to fit. If omitted, the source width is used. |
fHeightDest |
Val Variant |
The destination height of the picture. The ScaleMode property of the object determines the unit of measure used. If the destination height is larger or smaller than the source height (fHeightSrc), the picture is stretched or compressed to fit. If omitted, the source height is used. |
fXSrc |
Val Variant |
The horizontal coordinate (x-axis) of a clipping region within the picture. The ScaleMode property of the object determines the unit of measure used. If omitted, zero is assumed. |
fYSrc |
Val Variant |
The vertical coordinate (y-axis) of a clipping region within the picture. The ScaleMode property of the object determines the unit of measure used. If omitted, zero is assumed. |
fWidthSrc |
Val Variant |
The source width of a clipping region within the picture. The ScaleMode property of the object determines the unit of measure used. If omitted, the entire source width is used. |
fHeightSrc |
Val Variant |
The source height of a clipping region within the picture. The ScaleMode property of the object determines the unit of measure used. If omitted, the entire source height is used. |
enPictureDrawMode |
Val enumAFormPictureDrawMode |
Expects a boolean that specifies if the bitmap is to be stretched to the destination rectangle. |
enumAFormPictureDrawMode can be one of the following:
Name |
Value |
Description |
aformPictureDrawModeTile |
1 |
Tile. If the source area is smaller than the target area, the picture will be tiled to fill the target area. |
aformPictureDrawModeClip |
2 |
Clip. If the source area is larger than the target area, the picture will be clipped to fit the target area, starting at the top left-most position on the source area. |
aformPictureDrawModeStretch |
4 |
Stretch. If the source area is smaller than the target area, the source area will be stretched vertically and/or horiztonally as needed to fill the target area. |
aformPictureDrawModeTopLeft |
8 |
TopLeft. Start inserting the source area into the target area starting at the top left-most position on the target area. |
aformPictureDrawModeTopRight |
16 |
TopRight. Start inserting the source area into the target area starting at the top right-most position on the target area. |
aformPictureDrawModeBottomLeft |
32 |
BottomLeft.Start inserting the source area into the target area starting at the bottom left-most position on the target area. |
aformPictureDrawModeBottomRight |
64 |
BottomRight. Start inserting the source area into the target area starting at the bottom right-most position on the target area. |
aformPictureDrawModeCenter |
128 |
Center. Start inserting the source area into the target area starting from the center of the source area into the center of the target area. |
The graphics file can be of format: .bmp, .wmf, .emf, .cur, .ico, or .dib.
A bitmap can be flipped horizontally or vertically by using negative values for the destination height (height1) and/or the destination width (width1).
You can omit as many optional trailing arguments as you want. If you omit an optional trailing argument or arguments, do not use any commas following the last argument you specify. If you want to specify an optional argument, you must specify all optional arguments that appear in the syntax before it.
The PaintPicture method does not support named arguments.
The following statement displays MyPicture on the AForm at x=93 units (determined by the ScaleMode property) and y=45 units:
frm1.PaintPicture(MyPicture,93,45)
! More examples:
frm.PaintPicture(Form.Picture, 0, 0, 100, 100, ,,,,aformPitureDrawModeStretch)