CopyTo Method

NI Vision for Visual Basic

CopyTo Method

Syntax

CWIMAQRectangle.CopyTo DestRectangle

Purpose

Copies all of the properties from the source rectangle into the destination rectangle.

Parameters

DestRectangle As CWIMAQRectangle

The destination rectangle.

Example

Private Sub Run_Click()
    Dim Rectangle1 As New CWIMAQRectangle
    Dim Rectangle2 As New CWIMAQRectangle
    
    'Initialize the first rectangle
    Rectangle1.Initialize 3, 23, 19, 81
    
    'Copy the properties from the first rectangle into the second rectangle
    Rectangle1.CopyTo Rectangle2
    
    'Move the first rectangle. This move does not affect the second rectangle
    Rectangle1.Left = Rectangle1.Left + 70
    Rectangle1.Top = Rectangle1.Top + 70
    
    'Add the rectangles to the viewer's regions collection.
    CWIMAQViewer1.Regions.AddRectangle Rectangle1
    CWIMAQViewer1.Regions.AddRectangle Rectangle2
End Sub