Previous Document Next Document
Polygon.Sides

Property Sides As Long

Member of Polygon

The Sides property returns or sets the number of sides for a polygon.

The following code example displays the number of polygons with a different number of sides that exsit in the current document:

Sub Test() 
 Dim s As Shape 
 Dim str As String 
 Dim cnt(3 To 10) As Long, n As Long 
 For n = 3 To 10 
  cnt(n) = 0 
 Next n 
 For Each s In ActivePage.Shapes 
  If s.Type = cdrPolygonShape Then 
   n = s.Polygon.Sides 
   If n > 9 Then n = 10 
   cnt(n) = cnt(n) + 1 
  End If 
 Next s 
 str = "The document contains" & vbCr & _ 
  "the following polygons:" & vbCr & vbCr & _ 
  "Sides" & vbTab & "Count" 
 For n = 3 To 9 
  str = str & vbCr & n & vbTab & cnt(n) 
 Next n 
 If cnt(10) Then 
  str = str & vbCr & "Other" & vbTab & cnt(10) 
 End If 
 MsgBox str 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.