CopyTo Method

NI Vision for Visual Basic

CopyTo Method

Syntax

CWIMAQLines.CopyTo DestLines

Purpose

Copies the collection of one line into another.

Parameters

DestLines As CWIMAQLines

The lines collection to copy into.

Example

Private Sub Run_Click()
    Dim SourceLines As New CWIMAQLines
    Dim DestLines As New CWIMAQLines
    Dim I As Integer
    
    'Fill the SourceLines collection with data
    SourceLines.Add 3
    SourceLines(1).Initialize 81, 13, 54, 84
    SourceLines(2).Initialize 173, 58, 114, 44
    SourceLines(3).Initialize 162, 124, 44, 46
    
    'Fill the destination lines collection with data. This data will be
    'overwritten by the CopyTo below.
    DestLines.Add 1
    DestLines(1).Initialize 0, 0, 200, 200
    
    'Copy SourceLines into DestLines
    SourceLines.CopyTo DestLines
    
    'Overlay all of the lines in DestLines
    For I = 1 To DestLines.Count
        CWIMAQViewer1.Image.Overlays(1).DrawLine DestLines(I)
    Next I
End Sub