## 重载

 RotateTransform(Single) 将局部几何转换旋转指定大小。Rotates the local geometric transform by the specified amount. 此方法预先计算对转换的旋转。This method prepends the rotation to the transform. RotateTransform(Single, MatrixOrder) 将局部几何转换以指定顺序旋转指定量。Rotates the local geometric transform by the specified amount in the specified order.

## RotateTransform(Single)

``````public:
void RotateTransform(float angle);``````
``public void RotateTransform (float angle);``
``member this.RotateTransform : single -> unit``
``Public Sub RotateTransform (angle As Single)``

angle
Single

## RotateTransform(Single, MatrixOrder)

``````public:
void RotateTransform(float angle, System::Drawing::Drawing2D::MatrixOrder order);``````
``public void RotateTransform (float angle, System.Drawing.Drawing2D.MatrixOrder order);``
``member this.RotateTransform : single * System.Drawing.Drawing2D.MatrixOrder -> unit``
``Public Sub RotateTransform (angle As Single, order As MatrixOrder)``

angle
Single

order
MatrixOrder

### 示例

• 创建图形路径并向其添加一个矩形。Creates a graphics path and adds a rectangle to it.

• 从路径点创建一个 PathGradientBrush （在此示例中，点构成一个矩形，但它可以是大多数形状）。Creates a PathGradientBrush from the path points (in this example, the points form a rectangle, but it could be most any shape).

• 将中间颜色设置为红色，将周围颜色设置为蓝色。Sets the center color to red and the surrounding color to blue.

• 在应用旋转变换之前，将 PathGradientBrush 绘制到屏幕上。Draws the PathGradientBrush to the screen prior to applying the rotate transform.

• 使用画笔 RotateTransform 方法将旋转转换应用到画笔。Applies the rotate transform to the brush by using its RotateTransform method.

• 将旋转的画笔（矩形）绘制到屏幕上。Draws the rotated brush (rectangle) to the screen.

``````public:
void RotateTransformExample( PaintEventArgs^ e )
{
// Create a graphics path and add an ellipse.
GraphicsPath^ myPath = gcnew GraphicsPath;
Rectangle rect = Rectangle(100,20,100,50);

// Get the path's array of points.
array<PointF>^myPathPointArray = myPath->PathPoints;

// Create a path gradient brush.

// Set the color span.
myPGBrush->CenterColor = Color::Red;
array<Color>^ mySurroundColor = {Color::Blue};
myPGBrush->SurroundColors = mySurroundColor;

// Draw the brush to the screen prior to transformation.
e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 );

// Apply the rotate transform to the brush.
myPGBrush->RotateTransform( 45, MatrixOrder::Append );

// Draw the brush to the screen again after applying the
// transform.
e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 300 );
}
``````
``````public void RotateTransformExample(PaintEventArgs e)
{

// Create a graphics path and add an ellipse.
GraphicsPath myPath = new GraphicsPath();
Rectangle rect = new Rectangle(100, 20, 100, 50);

// Get the path's array of points.
PointF[] myPathPointArray = myPath.PathPoints;

// Create a path gradient brush.

// Set the color span.
myPGBrush.CenterColor = Color.Red;
Color[] mySurroundColor = {Color.Blue};
myPGBrush.SurroundColors = mySurroundColor;

// Draw the brush to the screen prior to transformation.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200);

// Apply the rotate transform to the brush.
myPGBrush.RotateTransform(45, MatrixOrder.Append);

// Draw the brush to the screen again after applying the
// transform.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 300);
}
``````
``````Public Sub RotateTransformExample(ByVal e As PaintEventArgs)

' Create a graphics path and add a rectangle.
Dim myPath As New GraphicsPath
Dim rect As New Rectangle(100, 20, 100, 50)

' Get the path's array of points.
Dim myPathPointArray As PointF() = myPath.PathPoints

' Create a path gradient brush.

' Set the color span.
myPGBrush.CenterColor = Color.Red
Dim mySurroundColor As Color() = {Color.Blue}
myPGBrush.SurroundColors = mySurroundColor

' Draw the brush to the screen prior to transformation.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200)

' Apply the rotate transform to the brush.
myPGBrush.RotateTransform(45, MatrixOrder.Append)

' Draw the brush to the screen again after applying the
' transform.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 300)
End Sub
``````