Previous Document Next Document
CrossPoints.Item

Property Item(Index As Long) As CrossPoint

Member of CrossPoints

The Item property returns the given intersection point. For example, CrossPoints(2) refers to the second crosspoint object in the CrossPoints collection of CorelDRAW.

The Item property is the default property and its reference can be omitted when referencing items in the collection. For example, CrossPoints.Item(2) is the same as CrossPoint(2).

The Item property returns a read-only value.

Parameters
Description
Index
Acts a preset placeholder for each object in a CrossPoints collection, uniquely identifying each member of the collection

The following code example creates two separate ellipses with the CreateEllipse method. The active document is cleared, both ellipses are added to the active selection, and the ellipses are combined to create a single shape object. The intersections, or CrossPoints, of this new shape are identified by creating small circles around each point, using its x- and y-coordinates to serve as the coordinates of the small circles. The number of crosspoints and the X position of the first crosspoint display in a message box.

Sub XPosition() 
 Dim s1 As Shape, s2 As Shape 
 Dim s As Shape 
 Dim cps As CrossPoints 
 Dim cp As CrossPoint 
 Set s1 = ActiveLayer.CreateEllipse(4, 2, 1, 0) 
 Set s2 = ActiveLayer.CreateEllipse(3, 1, 2, 5) 
 ActiveDocument.ClearSelection 
 s1.AddToSelection 
 s2.AddToSelection 
 ActiveSelection.Combine 
 Set s = ActiveSelection.Shapes(1) 
 Set cps = 
s.Curve.Subpaths(1).GetIntersections(s.Curve.Subpaths(2)) 
 MsgBox cps.Count 
 MsgBox cps.Item(1).PositionX 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.