DrawPicture

Draws the contents of a .bmp file on a Form or PictureBox.

Syntax

object.DrawPicture picture, x1, y1, width1, height1, x2, y2, width2, height2, opcode

The parts of the DrawPicture method syntax are described in the following table.

Part Description
object Optional. An object expression that evaluates to an object. If object is omitted, the Form object with the focus is assumed to be object.
picture Required. The source file of the graphic to be drawn onto object.
x1, y1 Required. Values indicating the destination coordinates (x-axis and y-axis) on object for picture to be drawn. The ScaleMode property of object determines the unit of measure used.
width1 Optional. Value indicating the destination width of picture. The ScaleMode property of object determines the unit of measure used. If the destination width is larger or smaller than the source width (width2), picture is stretched or compressed to fit. If omitted, the source width is used.
height1 Optional. Value indicating the destination height of picture. The ScaleMode property of object determines the unit of measure used. If the destination height is larger or smaller than the source height (height2), picture is stretched or compressed to fit. If omitted, the source height is used.
x2, y2 Optional. Values indicating the coordinates (x-axis and y-axis) of a clipping region within picture. The ScaleMode property of object determines the unit of measure used. If omitted, 0 is assumed.
width2 Optional. Single-precision value indicating the source width of a clipping region within picture. The ScaleMode property of object determines the unit of measure used. If omitted, the entire source width is used.
height2 Optional. Value indicating the source height of a clipping region within picture. The ScaleMode property of object determines the unit of measure used. If omitted, the entire source height is used.
opcode Optional. Value or code that is used only with bitmaps. It defines a bit-wise operation (such as vbMergeCopy or vbSrcAnd) that is performed on picture as it is drawn on object. For a complete list of bit-wise operator constants, see the RasterOp Constants topic in Visual Basic Help. The only supported codes are vbBlackness, vbNotCopyPen, vbInvert, vbXorPen, vbMergePen and vbWhiteness.

Remarks

You can flip a bitmap 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.