Previous Document Next Document
Segment.SubPathIndex

Property SubPathIndex As Long

Member of Segment

The SubPathIndex property returns the index value of the subpath to which the current segment belongs.

The SubPathIndex property returns a read-only value.

The following code example re-creates each segment of the selected curve as a separate shape and gives each a different outline color (depending on the subpath to which the original segment belonged):

Sub Test() 
 Dim s As Shape 
 Dim seg As Segment 
 If ActiveShape Is Nothing Then Exit Sub 
 If ActiveShape.Type <> cdrCurveShape Then Exit Sub 
 For Each seg In ActiveShape.Curve.Segments 
  Select Case seg.Type 
   Case cdrLineSegment 
    Set s = ActiveLayer.CreateLineSegment(seg.StartNode.PositionX, 
seg.StartNode.PositionY, _ 
      seg.EndNode.PositionX, seg.EndNode.PositionY) 
   Case cdrCurveSegment 
    Set s = ActiveLayer.CreateCurveSegment(seg.StartNode.PositionX, 
seg.StartNode.PositionY, _ 
      seg.EndNode.PositionX, seg.EndNode.PositionY, 
seg.StartingControlPointLength, _ 
      seg.StartingControlPointAngle, seg.EndingControlPointLength, 
seg.EndingControlPointAngle) 
  End Select 
  s.Outline.Color = ActivePalette.Color(seg.SubPathIndex + 12) 
 Next seg 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.