Initialize Method

NI Vision for Visual Basic

Initialize Method

Syntax

CWIMAQLine.Initialize X1, Y1, X2, Y2

Purpose

Sets all the properties of the line with one method call.

Parameters

X1 As Single

The x-coordinate of the start point.

Y1 As Single

The y-coordinate of the start point.

X2 As Single

The x-coordinate of the end point.

Y2 As Single

The y-coordinate of the end point.

Example

Private Sub Run_Click()
    Dim Line1 As New CWIMAQLine
    Dim Line2 As New CWIMAQLine
    
    'Initialize the first line
    Line1.Initialize 30, 140, 140, 30
    
    'Copy the properties from the first line into the second line.
    Line1.CopyTo Line2
    
    'Move the first line. This move does not affect the second line.
    With Line1
        .Start.X = .Start.X + 70
        .Start.Y = .Start.Y + 70
        .End.X = .End.X + 70
        .End.Y = .End.Y + 70
    End With
    
    'Add the lines to the viewer's regions collection.
    CWIMAQViewer1.Regions.AddLine Line1
    CWIMAQViewer1.Regions.AddLine Line2
End Sub

See Also

CopyTo