Previous Document Next Document
SegmentRange.Count

Property Count As Long

Member of SegmentRange

The Count property returns the number of segments in the range.

The Count property returns a read-only value.

The following code example displays the number of curve segments in the selected curve. It then allows the user to convert all curve segments to lines.

Sub Test() 
 Dim sgr As New SegmentRange 
 Dim seg As Segment 
 Dim r As VbMsgBoxResult 
 If ActiveShape Is Nothing Then Exit Sub 
 If ActiveShape.Type <> cdrCurveShape Then 
  MsgBox "Select a curve and try again" 
  Exit Sub 
 End If 
 For Each seg In ActiveShape.Curve.Segments 
  If seg.Type = cdrCurveSegment Then sgr.Add seg 
 Next seg 
 If sgr.Count = 0 Then 
  MsgBox "No curve segments found" 
 Else 
  r = MsgBox(sgr.Count & " curve segments found. Convert them to 
lines?", vbYesNo) 
  If r = vbYes Then 
   sgr.SetType cdrLineSegment 
  End If 
 End If 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.