GetBoundingRectangle Method

NI Vision for Visual Basic

GetBoundingRectangle Method

Syntax

CWIMAQRegion.GetBoundingRectangle Rectangle

Purpose

Returns the bounding rectangle of the region.

Parameters

Rectangle As CWIMAQRectangle

On return, the coordinates of a rectangle bounding this region object.

Example

Private Sub Run_Click()
    Dim RotatedRectangle As New CWIMAQRotatedRectangle
    Dim BoundingRectangle As New CWIMAQRectangle
    
    'Create a rotated rectangle
    RotatedRectangle.Initialize 120, 150, 200, 100, 45
    
    'Add the rotated rectangle to the viewer regions.
    CWIMAQViewer1.Regions.AddRotatedRectangle RotatedRectangle
    
    'Get the bounding rectangle of the viewer regions
    CWIMAQViewer1.Regions(1).GetBoundingRectangle BoundingRectangle
    
    'Add the bounding rectangle to the viewer regions and set its pen color
    CWIMAQViewer1.Regions.AddRectangle(BoundingRectangle).PenColor = vbYellow
End Sub