Object Model Reference : Classes : S : SegmentRange : Properties : SegmentRange.Count |
Property Count As Long
Member of SegmentRange
The Count property returns the number of segments in a segment range.
The Count property returns a read-only value.
The following VBA example displays the number of curve segments in the selected curve. It then lets you 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 |
Copyright 2013 Corel Corporation. All rights reserved.