Previous Document Next Document

Object Model Reference : Classes : S : Shape : Methods : Shape.IsOnShape


Shape.IsOnShape

Function IsOnShape(x As Double, y As Double, [HotArea As Double = -1]) As cdrPositionOfPointOverShape

Description

Member of Shape

The IsOnShape method determines whether a given point lies inside a shape or on its outline.

This method returns cdrPositionOfPointOverShape.

Parameter
Description
x
Specifies the horizontal position of the point in the active document
y
Specifies the vertical position of the point in the active document
HotArea
Specifies the tolerance radius in which to evaluate the presence of the shape. This parameter is optional, and its default value is -1.

VBA example

The following VBA example lets the user click anywhere in the document and determine whether any shape’s outline or fill area was clicked. If so, the color of the outline or fill is changed to yellow. This script runs until Esc is pressed.

Sub Test()
 Dim s As Shape
 Dim x As Double, y As Double
 While ActiveDocument.GetUserClick(x, y, 0, 100, False, cdrCursorPickOvertarget) = 0
  For Each s In ActivePage.Shapes
   Select Case s.IsOnShape(x, y)
    Case cdrOnMarginOfShape
     If s.Outline.Type = cdrOutline Then
      s.Outline.Color.RGBAssign 255, 255, 0
      Exit For
     End If
    Case cdrInsideShape
     s.Fill.UniformColor.RGBAssign 255, 255, 0
     Exit For
   End Select
  Next s
 Wend
End Sub

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.