API Documentation > CorelDRAW > 2025-v26 > Page > IVGPage
Page.SelectShapesFromRectangle method
Select all shapes in the given area and return a selection shape
Syntax:
Function SelectShapesFromRectangle(ByVal x1 As Double, ByVal y1 As Double, ByVal x2 As Double, ByVal y2 As Double, ByVal Touch As Boolean) As Shape
Parameters:
Name Type Description
x1
Double
y1
Double
x2
Double
y2
Double
Touch
Boolean
Remarks:
The SelectShapesFromRectangle method selects all shapes within a given rectangle as if selected with a marquee. This method creates a new selection and returns the selection-shape object.
Examples:
The following VBA example allows the user to pick a color, which is used to fill all shapes in a defined area. This procedure repeats until Esc is pressed.
Sub Test()
Dim d As Document
Dim sel As Shape, s As Shape
Dim x1 As Double, y1 As Double, x2 As Double, y2 As Double, Shift As Long
Dim c As New Color
Set d = ActiveDocument
c.UserAssign
While d.GetUserArea(x1, y1, x2, y2, Shift, 100, False, cdrCursorWinCross) = 0
  Set sel = d.ActivePage.SelectShapesFromRectangle(x1, y1, x2, y2, False)
  For Each s In sel.Shapes

 s.Fill.ApplyUniformFill c
  Next s
Wend 
End Sub