Previous Document Next Document

Object Model Reference : Classes : P : Page : Methods : Page.SelectShapesFromRectangle


Page.SelectShapesFromRectangle

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

Description

Member of Page

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.

Parameter
Description
x1
Specifies the x-coordinate of the upper-left corner of the rectangle, measured in document units
y1
Specifies the y-coordinate of the upper-left corner of the rectangle, measured in document units
x2
Specifies the x-coordinate of the lower-right corner of the rectangle, measured in document units
y2
Specifies the y-coordinate of the lower-right corner of the rectangle, measured in document units
Touch
Specifies whether to select shapes not completely enclosed within the rectangle
True selects shapes not completely enclosed within the rectangle.

VBA example

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

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.