Previous Document Next Document

Object Model Reference : Classes : S : SnapPoints : Properties : SnapPoints.Item


SnapPoints.Item

Property Item(Index As Long) As SnapPoint

Description

Member of SnapPoints

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

Item is the default property of the SnapPoints class, and its reference can be omitted when you are accessing items in a SnapPoints 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.

Parameter
Description
Index
Specifies the snap point by its index number

VBA example 1

The following VBA 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
VBA example 2

The following VBA 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 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 2013 Corel Corporation. All rights reserved.