Graphics.RotateTransform Método

Definición

Aplica la rotación especificada a la matriz de transformación de este Graphics.

Sobrecargas

Nombre Description
RotateTransform(Single)

Aplica la rotación especificada a la matriz de transformación de este Graphics.

RotateTransform(Single, MatrixOrder)

Aplica la rotación especificada a la matriz de transformación de esta Graphics en el orden especificado.

RotateTransform(Single)

Aplica la rotación especificada a la matriz de transformación de este Graphics.

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

Ángulo de rotación en grados.

Ejemplos

El ejemplo de código siguiente está diseñado para su uso con Windows Forms y requiere PaintEventArgse, que es un parámetro del controlador de eventos Paint. El código realiza las siguientes acciones:

  • Traduce la matriz de transformación del mundo del Windows Formulario por el vector (100, 0).

  • Gira la transformación del mundo por un ángulo de 30 grados, preponiendo la matriz de rotación a la matriz de transformación mundial.

  • Dibuja una elipse rotada traducida con un lápiz azul.

public:
   void RotateTransformAngle( PaintEventArgs^ e )
   {
      // Set world transform of graphics object to translate.
      e->Graphics->TranslateTransform( 100.0F, 0.0F );

      // Then to rotate, prepending rotation matrix.
      e->Graphics->RotateTransform( 30.0F );

      // Draw rotated, translated ellipse to screen.
      e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), 0, 0, 200, 80 );
   }
private void RotateTransformAngle(PaintEventArgs e)
{

    // Set world transform of graphics object to translate.
    e.Graphics.TranslateTransform(100.0F, 0.0F);

    // Then to rotate, prepending rotation matrix.
    e.Graphics.RotateTransform(30.0F);

    // Draw rotated, translated ellipse to screen.
    e.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
}
Private Sub RotateTransformAngle(ByVal e As PaintEventArgs)

    ' Set world transform of graphics object to translate.
    e.Graphics.TranslateTransform(100.0F, 0.0F)

    ' Then to rotate, prepending rotation matrix.
    e.Graphics.RotateTransform(30.0F)

    ' Draw rotated, translated ellipse to screen.
    e.Graphics.DrawEllipse(New Pen(Color.Blue, 3), 0, 0, 200, 80)
End Sub

Comentarios

La operación de rotación consiste en multiplicar la matriz de transformación por una matriz cuyos elementos se derivan del angle parámetro . Este método aplica la rotación por adelantado a la matriz de transformación.

Se aplica a

RotateTransform(Single, MatrixOrder)

Aplica la rotación especificada a la matriz de transformación de esta Graphics en el orden especificado.

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

Ángulo de rotación en grados.

order
MatrixOrder

Miembro de la MatrixOrder enumeración que especifica si la rotación se anexa o antepone a la transformación de matriz.

Ejemplos

El ejemplo de código siguiente está diseñado para su uso con Windows Forms y requiere PaintEventArgse, que es un parámetro del controlador de eventos Paint. El código realiza las siguientes acciones:

  • Traduce la matriz de transformación del mundo del Windows Formulario por el vector (100, 0).

  • Gira la transformación del mundo por un ángulo de 30 grados, anexando la matriz de rotación a la matriz de transformación del mundo con Append.

  • Dibuja una elipse traducida girada con un lápiz azul.

public:
   void RotateTransformAngleMatrixOrder( PaintEventArgs^ e )
   {
      // Set world transform of graphics object to translate.
      e->Graphics->TranslateTransform( 100.0F, 0.0F );

      // Then to rotate, appending rotation matrix.
      e->Graphics->RotateTransform( 30.0F, MatrixOrder::Append );

      // Draw translated, rotated ellipse to screen.
      e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), 0, 0, 200, 80 );
   }
private void RotateTransformAngleMatrixOrder(PaintEventArgs e)
{

    // Set world transform of graphics object to translate.
    e.Graphics.TranslateTransform(100.0F, 0.0F);

    // Then to rotate, appending rotation matrix.
    e.Graphics.RotateTransform(30.0F, MatrixOrder.Append);

    // Draw translated, rotated ellipse to screen.
    e.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
}
Private Sub RotateTransformAngleMatrixOrder(ByVal e As PaintEventArgs)

    ' Set world transform of graphics object to translate.
    e.Graphics.TranslateTransform(100.0F, 0.0F)

    ' Then to rotate, appending rotation matrix.
    e.Graphics.RotateTransform(30.0F, MatrixOrder.Append)

    ' Draw translated, rotated ellipse to screen.
    e.Graphics.DrawEllipse(New Pen(Color.Blue, 3), 0, 0, 200, 80)
End Sub

Comentarios

La operación de rotación consiste en multiplicar la matriz de transformación por una matriz cuyos elementos se derivan del angle parámetro . Este método antepone o anexa la matriz de transformación de por la matriz de Graphics rotación según el order parámetro .

Se aplica a