DrawPicture Method

NI Vision for Visual Basic

DrawPicture Method

Syntax

CWIMAQOverlay.DrawPicture Picture, Origin [, Width] [, Height]

Purpose

Draws a picture to the overlay. The picture can contain a bitmap, metafile, icon, or cursor.

Remarks

When a picture is drawn to the overlay, NI Vision copies it and stores it in memory. Changing the picture after calling DrawPicture does not affect the picture overlayed on the image.

Overlaying icons or cursors with inverted areas is not supported.

Parameters

Picture As Picture

The picture to overlay.

Origin As CWIMAQPoint

Indicates the top-left corner of where the picture will be drawn.

Width As Variant

[Optional] The width of the bounding rectangle of the picture. If not supplied, the default width of the picture object is used. For example, if Picture contains an icon, the default width is 32 pixels.

Height As Variant

[Optional] The height of the bounding rectangle of the picture. If not supplied, the default height of the picture object is used. For example, if Picture contains a bitmap, the height is set so the bitmap does not need to be stretched or compressed.

Example

Private Sub Run_Click()
    Dim Origin As New CWIMAQPoint
    
    'Draw the picture contained in the PictureBox onto the image on viewer1
    'Use the default width and height of the picture
    Origin.Initialize 50, 50
    CWIMAQViewer1.Image.Overlays(1).DrawPicture Picture1.Picture, Origin
End Sub