Previous Document Next Document
ShapeRange.Rotate

Sub Rotate(Angle As Double)

Member of ShapeRange

The Rotate method rotates all of the shapes in a range, treating the group as a single object. The center of rotation is specified by the RotationCenterX and RotationCenterY properties, while RotateEx allows you to specify the center of rotation directly.

Parameters
Description
Angle
Specifies, in degrees, the amount to rotate a range of shapes

The following code example creates a “flower” by duplicating circles. It then creates a larger flower by duplicating this group of six circles five more times to form six petals of different colors.

Sub Test() 
 Dim n As Long 
 Dim sr As New ShapeRange, sr1 As ShapeRange 
 Dim s As Shape 
 Set s = ActiveLayer.CreateEllipse2(0, 0, 0.5) 
 s.SetRotationCenter 1, 1 
 For n = 1 To 5 
  sr.Add s.Duplicate 
  s.Rotate 60 
 Next n 
 sr.Add s 
 sr.ApplyUniformFill CreateRGBColor(255, 0, 0) 
 sr.SetRotationCenter ActivePage.SizeWidth / 2, 
ActivePage.SizeHeight / 2 
 For n = 0 To 4 
  Set sr1 = sr.Duplicate 
  sr1.ApplyUniformFill CreateRGBColor(255, 255 * (1 - n / 5), 0) 
  sr.Rotate 60 
 Next n 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.