Previous Document Next Document
Page.SelectShapesFromRectangle

Function SelectShapesFromRectangle(x1 As Double, y1 As Double, x2 As Double, y2 As Double, Touch As Boolean) As Shape

Member of Page

The SelectShapesFromRectangle method selects all of the shapes within a given rectangle as if selected with a marquee.

This method creates a new selection and returns the selection-shape object.

Parameters
Description
x1
Defines the x-coordinate for the upper-left corner of a rectangle, measured in document units
y1
Defines the vertical for the upper-left corner of a rectangle, measured in document units
x2
Defines the x-coordinate for the lower-right corner of a rectangle, measured in document units
y2
Defines the vertical for the lower-right corner of a rectangle, measured in document units
Touch
If set to True, the shapes not completely enclosed within the rectangle area are also selected

The following code 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 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.