Graphics.RotateTransform Metodo

Definizione

Applica la rotazione specificata alla matrice di trasformazione di questo oggetto Graphics.

Overload

RotateTransform(Single)

Applica la rotazione specificata alla matrice di trasformazione di questo oggetto Graphics.

RotateTransform(Single, MatrixOrder)

Applica la rotazione specificata alla matrice di trasformazione di questo oggetto Graphics secondo l'ordine specificato.

RotateTransform(Single)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

Applica la rotazione specificata alla matrice di trasformazione di questo oggetto Graphics.

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

Parametri

angle
Single

Angolo di rotazione in gradi.

Esempio

L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgse, che è un parametro del Paint gestore eventi. Il codice esegue le azioni seguenti:

  • Converte la matrice di trasformazione globale di Windows Form in base al vettore (100, 0).

  • Ruota la trasformazione globale in base a un angolo di 30 gradi, anteponendo la matrice di rotazione alla matrice di trasformazione globale.

  • Disegna un'ellisse ruotata e tradotta con una penna blu.

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

Commenti

L'operazione di rotazione consiste nella moltiplicazione della matrice di trasformazione per una matrice i cui elementi sono derivati dal angle parametro . Questo metodo applica la rotazione anteponendola alla matrice di trasformazione.

Si applica a

RotateTransform(Single, MatrixOrder)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

Applica la rotazione specificata alla matrice di trasformazione di questo oggetto Graphics secondo l'ordine specificato.

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)

Parametri

angle
Single

Angolo di rotazione in gradi.

order
MatrixOrder

Membro dell'enumerazione MatrixOrder che specifica se la rotazione è anteposta o accodata alla matrice di trasformazione.

Esempio

L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgse, che è un parametro del Paint gestore eventi. Il codice esegue le azioni seguenti:

  • Converte la matrice di trasformazione globale di Windows Form in base al vettore (100, 0).

  • Ruota la trasformazione globale in base a un angolo di 30 gradi, aggiungendo la matrice di rotazione alla matrice di trasformazione globale con Append.

  • Disegna un'ellisse tradotta ruotata con una penna blu.

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

Commenti

L'operazione di rotazione consiste nella moltiplicazione della matrice di trasformazione per una matrice i cui elementi sono derivati dal angle parametro . Questo metodo antepone o aggiunge la matrice di trasformazione dell'oggetto Graphics dalla matrice di rotazione in base al order parametro .

Si applica a