Previous Document Next Document
Shape.Rotate

Sub Rotate(Angle As Double)

Member of Shape

The Rotate method rotates a shape. The center of rotation is specified by the RotationCenterX and RotationCenterY properties of the shape.

Parameters
Description
Angle
Specifies the number of degrees to rotate the shape

The following code example creates a flower with randomly-colored petals:

Sub Test() 
 Const NumLeafs As Long = 11 
 Dim pal As Palette 
 Dim s As Shape 
 Dim i As Long, NumColors As Long 
 Set s = Nothing 
 If ActivePalette Is Nothing Then 
  Set pal = Palettes.Open(Application.SetupPath & 
"Custom\coreldrw.cpl") 
 Else 
  Set pal = ActivePalette 
 End If 
 NumColors = pal.ColorCount 
 For i = 1 To NumLeafs 
  If s Is Nothing Then 
   Set s = ActiveLayer.CreateEllipse(5, 5, 7, 6) 
   s.RotationCenterX = 4 
   s.RotationCenterY = 5.5 
  Else 
   s.Duplicate 
  End If 
  s.Fill.ApplyUniformFill pal.Color(Rnd() * NumColors + 1) 
  s.Rotate 360 / NumLeafs 
 Next i 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.