Previous Document Next Document

Object Model Reference : Classes : C : Curve : Methods : Curve.IsOnCurve


Curve.IsOnCurve

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

Description

Member of Curve

The IsOnCurve method determines whether a given point is inside or outside of a curve or over its outline.

Parameter
Description
x
Specifies the horizontal position for the point in the active document, created in relation to the reference point
y
Specifies the vertical position (using the rulers as a reference) for the point in the active document, created in relation to the reference point
HotArea
Specifies 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.

VBA example

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

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.