| Flash for .NET Task-Based Help > C1FlashCanvas Tasks > Transforming a Drawing Using C1FlashCanvas > Rotating the Drawing |
To draw an ellipse, use the DrawEllipse method and to transform the drawing, call the TranslateTransform and RotateTransform methods:
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Imports C1.C1Flash
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.C1FlashCanvas1.Clear(Color.White)
' Resets the coordinate transform
Me.C1FlashCanvas1.ResetTransform()
Dim ptCenter As New Point(Me.C1FlashCanvas1.Width / 2, Me.C1FlashCanvas1.Height / 20)
' Moves the coordination origin point to the center of the canvas
Me.C1FlashCanvas1.TranslateTransform(ptCenter.X, ptCenter.Y)
Dim rect As New Rectangle(80, 140, 140, 180)
Dim i As Integer
i = 0
For i = 1 To 11
' Draws the ellipse with the same ellipse parameter
Me.C1FlashCanvas1.DrawEllipse(Pens.Red, rect)
Me.C1FlashCanvas1.FillEllipse(Brushes.LightYellow, rect)
' Rotates the coordination by 15 degrees
Me.C1FlashCanvas1.RotateTransform(15)
Next i
End Sub
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
using C1.C1Flash;
private void Form1_Load(object sender, System.EventArgs e)
{
this.c1FlashCanvas1.Clear(Color.White);
// Resets the coordinate transform
this.c1FlashCanvas1.ResetTransform();
Point ptCenter = new Point(this.c1FlashCanvas1.Width / 2, this.c1FlashCanvas1.Height / 20);
// Moves the coordination origin point to the center of the canvas
this.c1FlashCanvas1.TranslateTransform(ptCenter.X, ptCenter.Y);
Rectangle rect = new Rectangle(80, 140, 140, 180);
for(int i = 0; i < 12; i++)
{
// Draws the ellipse with the same ellipse parameter
this.c1FlashCanvas1.DrawEllipse(Pens.Red, rect);
this.c1FlashCanvas1.FillEllipse(Brushes.LightYellow, rect);
// Rotates the coordination by 15 degrees
this.c1FlashCanvas1.RotateTransform(15);
}
|
|
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Me.C1FlashCanvas1.RenderToFile("c:\WindowsApplication1.swf")
LaunchViewer("c:\WindowsApplication1.swf")
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
this.c1FlashCanvas1.RenderToFile(@"c:\WindowsApplication1.swf"); LaunchViewer(@"c:\WindowsApplication1.swf"); |
|
Here is what your drawing will look like in Internet Explorer:
