Previous Document Next Document
SegmentRange.Item

Property Item(Index As Long) As Segment

Member of SegmentRange

The Item property returns the specified Segment from the segment range.

The Item property is the default property and its reference can be omitted when referencing items in the range. For example, SegmentRange.Item(2) is the same as SegmentRange(2) — they both reference the second segment range object in the range.

The Item property returns a read-only value.

Parameters
Description
Index
Specifies the segment to return

The following code example adds a node to the middle of each curve segment in the selected curve:

Sub Test() 
 Dim sgr As SegmentRange 
 Dim n As Node 
 Dim i As Long 
 Set sgr = ActiveShape.Curve.Segments.All 
 For i = sgr.Count To 1 Step -1 
  If sgr(i).Type = cdrLineSegment Then sgr.Remove i 
  ' Same as: If sgr.Item(i).Type <> cdrLineSegment Then sgr.Remove i 
 Next i 
 If sgr.Count > 0 Then sgr.AddNode 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.