DrawPicture

This method draws the contents of a .bmp file on a PictureBox control.

Syntax

picturebox.DrawPicture picture, x, y, [width], [height], [sourcex], [sourcey], [sourcewidth], [sourceheight], [opcode]

Parameters

picturebox
Reference to a PictureBox control.
picture
Required. Source file of the graphic to be drawn.
x
Destination coordinates where picture will be drawn.
y
Destination coordinates where picture will be drawn.
width
Optional. Value that indicates the destination width of picture. If the destination width is larger or smaller than the source width (clipwidth), picture is stretched or compressed to fit. If omitted, the source width is used.
height
Optional. Value that indicates the destination height of picture. If the destination height is larger or smaller than the source height (clipheight), picture is stretched or compressed to fit. If omitted, the source height is used.
sourcex
Optional. Coordinates of a clipping region within picture. If omitted, 0 is assumed.
sourcey
Optional. Coordinates of a clipping region within picture. If omitted, 0 is assumed.
sourcewidth
Optional. Value that indicates the source width of a clipping region within picture. If omitted, the entire source width is used.
sourceheight
Optional. Value indicating the source height of a clipping region within picture. If omitted, the entire source height is used.
opcode
Optional. Defines a bit-wise operation that is performed on picture as it is drawn. The supported codes are vbBlackness, vbNotCopyPen, vbInvert, vbXorPen, vbMergePen and vbWhiteness.

Return Value

None.

Remarks

The ScaleMode property of the PictureBox determines the unit of measure used. You can flip a bitmap horizontally or vertically by using negative values for height and/or width.