GetBoundingRectangle Method
Syntax
CWIMAQRegions.GetBoundingRectangle Rectangle
Purpose
Gets the bounding rectangle of the regions of interest.
Parameters
Rectangle As CWIMAQRectangle
On return, the coordinates of a rectangle bounding all of the regions in the collection.
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 If TypeName(RotatedRectangle) = "Nothing" Then MsgBox "Number of rotated rectangles exceeded!" Else MsgBox "You added a rotated rectangle." End If 'Add a second rotated rectangle with a different angle to the viewer regions. RotatedRectangle.Angle = 15 CWIMAQViewer1.Regions.AddRotatedRectangle RotatedRectangle If TypeName(RotatedRectangle) = "Nothing" Then MsgBox "Number of rotated rectangles exceeded!" Else MsgBox "You added a rotated rectangle." End If 'Get the bounding rectangle of the viewer regions CWIMAQViewer1.Regions.GetBoundingRectangle BoundingRectangle 'Add the bounding rectangle to the viewer regions CWIMAQViewer1.Regions.AddRectangle BoundingRectangle If TypeName(BoundingRectangle) = "Nothing" Then MsgBox "Number of bounding rectangles exceeded!" Else MsgBox "You added a bounding rectangle." End If CWIMAQViewer1.Regions(CWIMAQViewer1.Regions.Count).PenColor = vbYellow End Sub