Previous Document Next Document
ShapeRange.GetBoundingBox

Sub GetBoundingBox(x As Double, y As Double, Width As Double, Height As Double, [UseOutline As Boolean = False])

Member of ShapeRange

The GetBoundingBox method returns the position of the lower-left corner of all of the objects in the range, treating the group of shapes as a single object. It also returns the total size of all of the objects in the range.

If the UseOutline parameter is True, any outlines of shapes are taken into account when calculating the dimensions of the bounding box. Otherwise, the shapes are treated as if they had no outline.

See also the PositionX, PositionY, SizeWidth, and SizeHeight properties, as well as the GetPosition, SetPosition, GetSize, SetSize, SetSizeEx, and Move methods.

Parameters
Description
x
Returns the x-coordinate of the lower-left corner
y
Returns the y-coordinate of the lower-left corner
Width
Returns the width of all objects
Height
Returns the height of all objects
UseOutline
Specifies whether outlines are considered when calculating the size of the bounding box
This parameter is optional, and its default value is False.

The following code example creates a rectangle that surrounds an ellipse:

Sub Test() 
 Dim s As Shape 
 Dim sr As ShapeRange 
 Dim x As Double, y As Double, w As Double, h As Double 
 Set s = ActiveLayer.CreateEllipse(1, 2, 3, 4) 
 ActiveDocument.ReferencePoint = cdrCenter 
 Set sr = ActivePage.Shapes.All 
 sr.GetBoundingBox x, y, w, h 
 ActiveLayer.CreateRectangle2 x, y, w, y 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.