Previous Document Next Document

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


Page.SelectShapesAtPoint

Function SelectShapesAtPoint(x As Double, y As Double, SelectUnfilled As Boolean, [HotArea As Double = -1]) As Shape

Description

Member of Page

The SelectShapesAtPoint method selects all shapes at a specified point in a document. This method creates a new selection and returns the selection-shape object.

Parameter
Description
x
Specifies, in document units, the x-coordinate of the point
y
Specifies, in document units, the y-coordinate of the point
SelectUnfilled
Specifies whether to select the shapes inside the shape
HotArea
Specifies the area around the point to include. This parameter is optional, and its default value is -1.

VBA example

The following VBA example allows the user to click over a shape. The shape’s fill is then changed by shifting its hue by 30°.

Sub Test()
 Dim d As Document
 Dim sel As Shape, s As Shape
 Dim x As Double, y As Double, Shift As Long
 Dim c As New Color
 Set d = ActiveDocument
 d.ShapeEnumDirection = cdrShapeEnumBottomFirst
 While d.GetUserClick(x, y, Shift, 100, False, cdrCursorWinArrow) = 0
  Set sel = d.ActivePage.SelectShapesAtPoint(x, y, False)
  If sel.Shapes.Count > 0 Then
   Set s = sel.Shapes(1)
   d.ClearSelection
   s.AddToSelection
   If s.Fill.Type <> cdrUniformFill Then
    s.Fill.UniformColor.RGBAssign 255, 0, 0
   Else
    c.CopyAssign s.Fill.UniformColor
    c.ConvertToHLS
    c.HLSHue = (c.HLSHue + 30) Mod 360
    s.Fill.ApplyUniformFill c
   End If
  End If
 Wend
End Sub

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.