PathGradientBrush.RotateTransform Método

Definição

Aplica uma rotação horária do ângulo especificado para a transformação geométrica local.Applies a clockwise rotation of the specified angle to the local geometric transform.

Sobrecargas

RotateTransform(Single)

Gira a transformação geométrica local pelo valor especificado.Rotates the local geometric transform by the specified amount. Esse método acrescenta a rotação ao começo da transformação.This method prepends the rotation to the transform.

RotateTransform(Single, MatrixOrder)

Gira a transformação geométrica local pela quantidade especificada na ordem especificada.Rotates the local geometric transform by the specified amount in the specified order.

RotateTransform(Single)

Gira a transformação geométrica local pelo valor especificado.Rotates the local geometric transform by the specified amount. Esse método acrescenta a rotação ao começo da transformação.This method prepends the rotation to the transform.

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

Parâmetros

angle
Single

O ângulo (extensão) de rotação.The angle (extent) of rotation.

Exemplos

Para ver um exemplo, consulte RotateTransform.For an example, see RotateTransform.

Aplica-se a

RotateTransform(Single, MatrixOrder)

Gira a transformação geométrica local pela quantidade especificada na ordem especificada.Rotates the local geometric transform by the specified amount in the specified order.

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)

Parâmetros

angle
Single

O ângulo (extensão) de rotação.The angle (extent) of rotation.

order
MatrixOrder

Um MatrixOrder que especifica se é necessário acrescentar algo ao começo ou no fim da matriz de rotação.A MatrixOrder that specifies whether to append or prepend the rotation matrix.

Exemplos

O exemplo de código a seguir foi projetado para uso com Windows Forms, e ele requer PaintEventArgs e um OnPaint objeto de evento.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, an OnPaint event object. O código executa as seguintes ações:The code performs the following actions:

  • Cria um caminho de gráficos e adiciona um retângulo a ele.Creates a graphics path and adds a rectangle to it.

  • Cria um PathGradientBrush dos pontos de caminho (neste exemplo, os pontos formam um retângulo, mas pode ser a maioria das formas).Creates a PathGradientBrush from the path points (in this example, the points form a rectangle, but it could be most any shape).

  • Define a cor central como vermelha e a cor ao redor como azul.Sets the center color to red and the surrounding color to blue.

  • Desenha o PathGradientBrush para a tela antes de aplicar a transformação girar.Draws the PathGradientBrush to the screen prior to applying the rotate transform.

  • Aplica a transformação girar ao Pincel usando seu RotateTransform método.Applies the rotate transform to the brush by using its RotateTransform method.

  • Desenha o pincel girado (retângulo) na tela.Draws the rotated brush (rectangle) to the screen.

Observe que o retângulo inferior é girado 45 graus em comparação com aquele desenhado antes da tradução.Notice that the bottom rectangle is rotated 45 degrees as compared to the one drawn prior to the translation.

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

Aplica-se a