Object Model Reference : Classes : C : Curve : Methods : Curve.IsOnCurve |
Function IsOnCurve(x As Double, y As Double, [HotArea As Double = -1]) As cdrPositionOfPointOverShape
Member of Curve
The IsOnCurve method determines whether a given point is inside or outside of a curve or over its outline.
The following VBA examples creates a rectangle in the active document and converts the rectangle to a curve. The ShowOnCurve function is called, coordinates are passed to the function, and a message box displays each point position in relation to the rectangle.
Sub OnCurve() |
Dim s As Shape |
Set s = ActiveLayer.CreateRectangle(0, 0, 2, 2) |
s.ConvertToCurves |
ShowOnCurve 1, 1, s.Curve.IsOnCurve(1, 1) |
ShowOnCurve 1, 0, s.Curve.IsOnCurve(1, 0) |
ShowOnCurve 1, 3, s.Curve.IsOnCurve(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 shape" |
Case cdrOnMarginOfShape |
s = s & "over the outline" |
Case cdrInsideShape |
s = s & "inside the shape" |
End Select |
MsgBox s |
End Function |
Copyright 2013 Corel Corporation. All rights reserved.