PathGradientBrush.RotateTransform Метод

Определение

Применяет по часовой стрелке указанного угла к локальному геометрическому преобразованию.

Перегрузки

Имя Описание
RotateTransform(Single)

Поворот локального геометрического преобразования по указанному количеству. Этот метод добавляет поворот к преобразованию.

RotateTransform(Single, MatrixOrder)

Поворот локального геометрического преобразования по указанному количеству в указанном порядке.

RotateTransform(Single)

Исходный код:
PathGradientBrush.cs
Исходный код:
PathGradientBrush.cs
Исходный код:
PathGradientBrush.cs
Исходный код:
PathGradientBrush.cs
Исходный код:
PathGradientBrush.cs
Исходный код:
PathGradientBrush.cs
Исходный код:
PathGradientBrush.cs
Исходный код:
PathGradientBrush.cs

Поворот локального геометрического преобразования по указанному количеству. Этот метод добавляет поворот к преобразованию.

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

Параметры

angle
Single

Угол (экстент) поворота.

Примеры

Пример см. в разделе RotateTransform.

Применяется к

RotateTransform(Single, MatrixOrder)

Исходный код:
PathGradientBrush.cs
Исходный код:
PathGradientBrush.cs
Исходный код:
PathGradientBrush.cs
Исходный код:
PathGradientBrush.cs
Исходный код:
PathGradientBrush.cs
Исходный код:
PathGradientBrush.cs
Исходный код:
PathGradientBrush.cs
Исходный код:
PathGradientBrush.cs

Поворот локального геометрического преобразования по указанному количеству в указанном порядке.

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

Значение, MatrixOrder указывающее, следует ли добавлять или добавлять матрицу поворота.

Примеры

Следующий пример кода предназначен для использования с Windows Forms и требуется PaintEventArgse, объект события OnPaint. Код выполняет следующие действия:

  • Создает графический путь и добавляет в него прямоугольник.

  • PathGradientBrush Создает из точек пути (в этом примере точки образуют прямоугольник, но это может быть большая часть любой фигуры).

  • Задает центровый цвет красным и окружающим цветом синий.

  • Рисует на PathGradientBrush экран перед применением преобразования поворота.

  • Применяет преобразование поворота к кисти с помощью его RotateTransform метода.

  • Рисует поворачиваемую кисть (прямоугольник) на экран.

Обратите внимание, что нижний прямоугольник поворачивается на 45 градусов по сравнению с тем, что нарисованный до перевода.

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

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

      // Create a path gradient brush.
      PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray );

      // 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);
    myPath.AddRectangle(rect);
             
    // Get the path's array of points.
    PointF[] myPathPointArray = myPath.PathPoints;
             
    // Create a path gradient brush.
    PathGradientBrush myPGBrush = new
        PathGradientBrush(myPathPointArray);
             
    // 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)
    myPath.AddRectangle(rect)

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

    ' Create a path gradient brush.
    Dim myPGBrush As New PathGradientBrush(myPathPointArray)

    ' 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

Применяется к