Object Model Reference : Classes : P : Page : Methods : 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 shapes at a specified point in a document. This method creates a new selection and returns the selection-shape object.
The following VBA example allows the user to click over a shape. The shapes 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 |
Copyright 2013 Corel Corporation. All rights reserved.