Previous Document Next Document
SnapPoints.Item

Property Item(Index As Long) As SnapPoint

Member of SnapPoints

The Item property returns the specified SnapPoint object from the collection.

The Item property is the default property, and its reference can be omitted when accessing an item in the collection. For example, SnapPoints.Item(5) is the same as SnapPoints(5) — they both reference the fifth point in the collection.

The Item property returns a read-only value.

Parameters
Description
Index
Specifies the snap point by its index number

The following code example creates a rectangle with rounded corners and marks each snap point with a small circle:

Sub Test() 
 Dim s As Shape 
 Dim sp As SnapPoint, i As Long 
 Set s = ActiveLayer.CreateRectangle2(0, 0, 2, 2, 0.5, 0.5, 0.5, 0.5) 
 For i = 1 To s.SnapPoints.Count 
  Set sp = s.SnapPoints(i) 
  ActiveLayer.CreateEllipse2 sp.PositionX, sp.PositionY, 0.05 
 Next i 
End Sub 

The following code example performs the same procedure as the previous example. However, instead of using a For Next command, it uses the For Each command in Visual Basic to iterate through all of the snap points in the collection.

Sub Test() 
 Dim s As Shape 
 Dim sp As SnapPoint 
 Set s = ActiveLayer.CreateRectangle2(0, 0, 2, 2, 0.5, 0.5, 0.5, 0.5) 
 For Each sp In s.SnapPoints 
  ActiveLayer.CreateEllipse2 sp.PositionX, sp.PositionY, 0.05 
 Next sp 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.