Previous Document Next Document
Shape.GetBoundingBox

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

Member of Shape

The GetBoundingBox method gets the size of an object and the position of its lower-left corner.

If the UseOutline parameter is True, then the outline width and shape are accounted for when calculating the bounding-box dimensions. Otherwise, the shape is treated as if it has no outline.

Parameters
Description
x
Defines the horizontal, or x-, coordinate for the lower-left corner. This value is measured in document units.
y
Defines the vertical, or y-, coordinate for the lower-left corner. This value is measured in document units.
Width
Defines the horizontal length. This value is measured in document units.
Height
Defines the vertical length. This value is measured in document units.
UseOutline
Determines whether the outline is included in measurements
This parameter is optional, and its default value is False.

The following code example creates a rectangle around each shape on the active page:

Sub Test() 
 Dim s As Shape 
 Dim x As Double, y As Double, w As Double, h As Double 
 ActiveDocument.ReferencePoint = cdrBottomLeft 
 For Each s In ActivePage.Shapes 
  s.GetBoundingBox x, y, w, h 
  ActiveLayer.CreateRectangle2 x, y, s.SizeWidth, s.SizeHeight 
 Next s 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.