CopyTo Method

NI Vision for Visual Basic

CopyTo Method

Syntax

CWIMAQRotatedRectangle.CopyTo DestRotatedRectangle

Purpose

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

Parameters

DestRotatedRectangle As CWIMAQRotatedRectangle

The destination rotated rectangle object.

Example

Private Sub Run_Click()
    Dim RotatedRectangle1 As New CWIMAQRotatedRectangle
    Dim RotatedRectangle2 As New CWIMAQRotatedRectangle
    Dim BoundingRectangle As New CWIMAQRectangle
    
    'Initialize the first rotated rectangle
    RotatedRectangle1.Initialize 3, 23, 19, 81, 15
    
    'Copy the properties from the first rotated rectangle into the second rotated rectangle
    RotatedRectangle1.CopyTo RotatedRectangle2
    
    'Move the first rotated rectangle. This move does not affect the second rotated rectangle
    RotatedRectangle1.Center.X = RotatedRectangle1.Center.X + 70
    RotatedRectangle1.Center.Y = RotatedRectangle1.Center.Y + 70
    
    'Get the bounding rectangle of the first rotated rectangle
    RotatedRectangle1.GetBoundingRectangle BoundingRectangle
    
    'Add the rotated rectangles to the viewer's regions collection.
    CWIMAQViewer1.Regions.AddRotatedRectangle RotatedRectangle1
    CWIMAQViewer1.Regions.AddRotatedRectangle RotatedRectangle2
    
    'Add the bounding rectangle to the viewer's regions collection and change its color to red.
    CWIMAQViewer1.Regions.AddRectangle(BoundingRectangle).PenColor = vbRed
End Sub