Previous Document Next Document
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 the curve, or over its outline.

Parameters
Description
x
Sets the horizontal position for a point in the active document, created in relation to the reference point
y
Sets the vertical position (using the CorelDRAW rulers as a reference) for a point in the active document, created in relation to the reference point
HotArea
Defines a restricted area on the curve in which to evaluate the position of a point
This parameter is optional, and its default value is -1.

The following code 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 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.