# Matrix.Rotate method

Applies to: desktop apps only

The Matrix::Rotate method updates this matrix with the product of itself and a rotation matrix.

### Syntax

```Status Rotate(
[in]  REAL angle,
[in]  MatrixOrder order
);
```

### Parameters

angle [in]

Type: REAL

Real number that specifies the angle of rotation in degrees. Positive values specify clockwise rotation.

order [in]

Type: MatrixOrder

Optional. Element of the MatrixOrder enumeration that specifies the order of the multiplication. MatrixOrderPrepend specifies that the rotation matrix is on the left, and MatrixOrderAppend specifies that the rotation matrix is on the right. The default value is MatrixOrderPrepend.

### Return value

Type:

Type: Status

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.

### Examples

The following example creates a Matrix object and calls the Matrix::Translate method to set the elements of that matrix to a translation. Then the code calls the Matrix::Rotate method to update the matrix with the product of itself and a rotation matrix. At that point, the matrix represents a composite transformation: first translate, then rotate. The code uses the matrix to set the world transformation of a Graphics object and then draws an ellipse that is transformed according to the composite transformation.

```
VOID Example_Rotate(HDC hdc)
{
Graphics graphics(hdc);
Pen pen(Color(255, 0, 0, 255));

Matrix matrix;
matrix.Translate(40.0f, 0.0f);            // first a translation
matrix.Rotate(30.0f, MatrixOrderAppend);  // then a rotation

graphics.SetTransform(&matrix);
graphics.DrawEllipse(&pen, 0, 0, 100, 50);
}

```

### Requirements

 Minimum supported client Windows XP, Windows 2000 Professional Windows 2000 Server GDI+ 1.0 Gdiplusmatrix.h (include Gdiplus.h) Gdiplus.lib Gdiplus.dll

Matrix
MatrixOrder
Matrix::Multiply
Matrix::RotateAt
Matrix::Scale
Matrix::Shear
Matrix::Translate
Transformations
Global and Local Transformations
Matrix Representation of Transformations

Build date: 3/6/2012