Initialize Method

NI Vision for Visual Basic

Initialize Method

Syntax

CWIMAQPoints.Initialize XPointArray, YPointArray

Purpose

Builds a points collection from an array of x-coordinates and an array of y-coordinates.

Remarks

If XPointArray and YPointArray are not the same size, the number of points added is equal to the minimum size of the two arrays.

Parameters

XPointArray As Variant

The x-coordinates of the points to set.

YPointArray As Variant

The y-coordinates of the points to set.

Example

Private Sub Run_Click()
    Dim SourcePoints As New CWIMAQPoints
    Dim DestPoints As New CWIMAQPoints
    
    'Initialize the SourcePoints collection with data
    SourcePoints.Initialize Array(50, 100, 100, 50, 50), Array(50, 50, 100, 100, 50)
    
    'Fill the destination points collection with data. This data will be
    'overwritten by the CopyTo below.
    DestPoints.Initialize 200, 200
    
    'Copy SourcePoints into DestPoints
    SourcePoints.CopyTo DestPoints
    
    'Overlay the points in DestPoints
    CWIMAQViewer1.Image.Overlays(1).DrawConnectedPoints DestPoints, cwimaqOverlayModeFrame
End Sub

See Also

CopyTo