Graphics.RotateTransform Method (Single)
Applies the specified rotation to the transformation matrix of this Graphics.
Namespace: System.Drawing
Assembly: System.Drawing (in System.Drawing.dll)
Parameters
- angle
- Type: System.Single
Angle of rotation in degrees.
The following code 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 transformation by an angle of 30 degrees, prepending the rotation matrix to the world transformation matrix.
Draws a rotated, translated ellipse with a blue pen.
private void RotateTransformAngle(PaintEventArgs e) { // Set world transform of graphics object to translate. e.Graphics.TranslateTransform(100.0F, 0.0F); // Then to rotate, prepending rotation matrix. e.Graphics.RotateTransform(30.0F); // Draw rotated, translated ellipse to screen. e.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80); }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.