Previous Document Next Document
Page.SelectShapesAtPoint

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

Member of Page

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

Parameters
Description
x
Specifies the x-coordinate of the point. This value is measured in document units.
y
Specifies the y-coordinate of the point. This value is measured in document units
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.

The following code 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 2007 Corel Corporation. All rights reserved.