API Documentation > CorelDRAW > 2025-v26 > Shape > IVGShape
Shape.SetSizeEx method
Sets the shape size by using the anchor point
Syntax:
Sub SetSizeEx(ByVal CenterX As Double, ByVal CenterY As Double, Optional ByVal Width As Double = 0, Optional ByVal Height As Double = 0)
Parameters:
Name Type Description
CenterX
Double
CenterY
Double
Width
Double
Specifies the horizontal measurement, in document units.
Height
Double
Specifies the vertical measurement, in document units.
Remarks:
The SetSizeEx method stretches a shape to a specified width and height, relative to the coordinates specified as the anchor point. The anchor point remains stationary, and it therefore represents the center of the distortion. Omitting a parameter calculates the size to maintain the proportions of the shape. See also the Shape.SetBoundingBox method, as well as the Shape.SizeWidth and Shape.SizeHeight properties.
Examples:
The following VBA example stretches all shapes on the active layer proportionally so that their horizontal size is 2".
Sub Test()
Dim x As Double, y As Double
Dim sr As ShapeRange
Set sr = ActiveLayer.Shapes.All
If sr.Count > 0 Then
  ActiveDocument.ReferencePoint = cdrCenter
  sr.GetPosition x, y
  sr.SetSizeEx x, y, 2
End If 
End Sub