Applies a clockwise rotation about the specified point to this Matrix in the specified order.
Assembly: System.Drawing (in System.Drawing.dll)
Public Sub RotateAt ( _ angle As Single, _ point As PointF, _ order As MatrixOrder _ )
public void RotateAt( float angle, PointF point, MatrixOrder order )
public: void RotateAt( float angle, PointF point, MatrixOrder order )
member RotateAt : angle:float32 * point:PointF * order:MatrixOrder -> unit
Parameters
- angle
- Type: System.Single
The angle of the rotation, in degrees.
- point
- Type: System.Drawing.PointF
A PointF that represents the center of the rotation.
- order
- Type: System.Drawing.Drawing2D.MatrixOrder
A MatrixOrder that specifies the order (append or prepend) in which the rotation is applied.
The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e, an Paint event object. The code performs the following actions:
-
Draws a rectangle to the screen prior to applying a rotation transform (the blue rectangle).
-
Creates a matrix and rotates it 45 degrees around a specified point.
-
Applies this matrix transform is to the rectangle.
-
Draws the transformed rectangle to the screen (the red rectangle).
Notice that the red rectangle has been rotated around the upper left-hand corner of the rectangle (the rotation point specified the RotateAt method).
Public Sub RotateAtExample(ByVal e As PaintEventArgs) Dim myPen As New Pen(Color.Blue, 1) Dim myPen2 As New Pen(Color.Red, 1) Dim rotatePoint As New PointF(150.0F, 50.0F) ' Draw the rectangle to the screen before applying the ' transform. e.Graphics.DrawRectangle(myPen, 150, 50, 200, 100) ' Create a matrix and rotate it 45 degrees. Dim myMatrix As New Matrix myMatrix.RotateAt(45, rotatePoint, MatrixOrder.Append) ' Draw the rectangle to the screen again after applying the ' transform. e.Graphics.Transform = myMatrix e.Graphics.DrawRectangle(myPen2, 150, 50, 200, 100) End Sub
public void RotateAtExample(PaintEventArgs e) { Pen myPen = new Pen(Color.Blue, 1); Pen myPen2 = new Pen(Color.Red, 1); PointF rotatePoint = new PointF(150.0f, 50.0f); // Draw the rectangle to the screen before applying the // transform. e.Graphics.DrawRectangle(myPen, 150, 50, 200, 100); // Create a matrix and rotate it 45 degrees. Matrix myMatrix = new Matrix(); myMatrix.RotateAt(45, rotatePoint, MatrixOrder.Append); // Draw the rectangle to the screen again after applying the // transform. e.Graphics.Transform = myMatrix; e.Graphics.DrawRectangle(myPen2, 150, 50, 200, 100); }
public: void RotateAtExample( PaintEventArgs^ e ) { Pen^ myPen = gcnew Pen( Color::Blue,1.0f ); Pen^ myPen2 = gcnew Pen( Color::Red,1.0f ); PointF rotatePoint = PointF(150.0f,50.0f); // Draw the rectangle to the screen before applying the // transform. e->Graphics->DrawRectangle( myPen, 150, 50, 200, 100 ); // Create a matrix and rotate it 45 degrees. Matrix^ myMatrix = gcnew Matrix; myMatrix->RotateAt( 45, rotatePoint, MatrixOrder::Append ); // Draw the rectangle to the screen again after applying the // transform. e->Graphics->Transform = myMatrix; e->Graphics->DrawRectangle( myPen2, 150, 50, 200, 100 ); }
.NET Framework
Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0.NET Framework Client Profile
Supported in: 4, 3.5 SP1Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.