Previous Document Next Document

Object Model Reference : Classes : S : SubPath : Methods : SubPath.IsOnSubPath


SubPath.IsOnSubPath

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

Description

Member of SubPath

The IsOnSubPath method returns the position of a point relative to a subpath. The coordinate can be inside or outside the subpath, or it can be over the outline of the subpath.

The IsOnSubPath method returns a value of cdrPositionOfPointOverShape.

Parameter
Description
x
Specifies, in document units, the horizontal position of the point
y
Specifies, in document units, the vertical position of the point
HotArea
Specifies a restricted area on the subpath in which to evaluate the position of the point. This parameter is optional, and its default value is -1.

VBA example

The following VBA example creates a rectangle and tests where various point coordinates are located relative to that rectangle.

Public Sub Test()
 Dim s As Shape, spath As SubPath
 Set s = ActiveLayer.CreateRectangle(0, 0, 2, 2)
 s.ConvertToCurves
 Set spath = s.Curve.Subpaths(1)
 ShowOnCurve 1, 1, spath.IsOnSubPath(1, 1)
 ShowOnCurve 1, 0, spath.IsOnSubPath(1, 0)
 ShowOnCurve 1, 3, spath.IsOnSubPath(1, 3)
End Sub
Private Function ShowOnCurve(x As Double, y As Double, v As cdrPositionOfPointOverShape)
 Dim s As String
 s = "Point (" & x & "," & y & ") is "
 Select Case v
  Case cdrOutsideShape
   s = s & "outside the subpath"
  Case cdrOnMarginOfShape
   s = s & "over the outline"
  Case cdrInsideShape
   s = s & "inside the subpath"
 End Select
 MsgBox s
End Function

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.