This documentation is archived and is not being maintained.

Graphics.RotateTransform Method

Applies the specified rotation to the transformation matrix of this Graphics object.

Overload List

Applies the specified rotation to the transformation matrix of this Graphics object.

[Visual Basic] Overloads Public Sub RotateTransform(Single)
[C#] public void RotateTransform(float);
[C++] public: void RotateTransform(float);
[JScript] public function RotateTransform(float);

Applies the specified rotation to the transformation matrix of this Graphics object in the specified order.

[Visual Basic] Overloads Public Sub RotateTransform(Single, MatrixOrder)
[C#] public void RotateTransform(float, MatrixOrder);
[C++] public: void RotateTransform(float, MatrixOrder);
[JScript] public function RotateTransform(float, MatrixOrder);

Example

[Visual Basic, C#] The following example is designed for use with Windows Forms, and it requires PaintEventArgs e, which is a parameter of the Paint event handler. The code performs the following actions:

  • Translates the world transformation matrix of the Windows form by the vector (100, 0).
  • Rotates the world transform by an angle of 30 degrees, appending the rotation matrix to the world transformation matrix with MatrixOrder.Append.
  • Draws a translated, rotated ellipse with a blue pen.
[Visual Basic, C#] Note   This example shows how to use one of the overloaded versions of RotateTransform. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Public Sub RotateTransformAngleMatrixOrder(e As PaintEventArgs)
' Set world transform of graphics object to translate.
e.Graphics.TranslateTransform(100F, 0F)
' Then to rotate, appending rotation matrix.
e.Graphics.RotateTransform(30F, MatrixOrder.Append)
' Draw translated, rotated ellipse to screen.
e.Graphics.DrawEllipse(New Pen(Color.Blue, 3), 0, 0, 200, 80)
End Sub
        
[C#] 
public void RotateTransformAngleMatrixOrder(PaintEventArgs e)
{
// Set world transform of graphics object to translate.
e.Graphics.TranslateTransform(100.0F, 0.0F);
// Then to rotate, appending rotation matrix.
e.Graphics.RotateTransform(30.0F, MatrixOrder.Append);
// Draw translated, rotated ellipse to screen.
e.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
}
        

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

Graphics Class | Graphics Members | System.Drawing Namespace

Show: