Object Model Reference : Classes : C : CrossPoints : Properties : CrossPoints.Item |
Property Item(Index As Long) As CrossPoint
Member of CrossPoints
The Item property returns the specified crosspoint (or CrossPoint object) in a CrossPoints collection. For example, CrossPoints(2) refers to the second crosspoint object in the collection.
Item is the default property of the CrossPoints class, and its reference can be omitted when you are accessing items in a CrossPoints collection. For example, CrossPoints.Item(2) is the same as CrossPoint(2) they both reference the second crosspoint in the collection.
The Item property returns a read-only value.
Parameter
|
Description
|
Index
|
Specifies the preset placeholder that uniquely identifies each member of a CrossPoints collection
|
The following VBA 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 |
Copyright 2013 Corel Corporation. All rights reserved.