Partage via


Graphics.RotateTransform Méthode

Définition

Applique la rotation spécifiée à la matrice de transformation de cette Graphics.

Surcharges

RotateTransform(Single)

Applique la rotation spécifiée à la matrice de transformation de cette Graphics.

RotateTransform(Single, MatrixOrder)

Applique la rotation spécifiée à la matrice de transformation de cette Graphics dans l’ordre spécifié.

RotateTransform(Single)

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

Applique la rotation spécifiée à la matrice de transformation de cette Graphics.

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

Paramètres

angle
Single

Angle de rotation en degrés.

Exemples

L’exemple de code suivant est conçu pour être utilisé avec Windows Forms et nécessite PaintEventArgse, qui est un paramètre du gestionnaire d’événements Paint. Le code effectue les actions suivantes :

  • Traduit la matrice de transformation mondiale du Windows Form par le vecteur (100, 0).

  • Fait pivoter la transformation du monde à un angle de 30 degrés, en préinitant la matrice de rotation vers la matrice de transformation du monde.

  • Dessine un ellipse pivoté et traduit avec un stylet bleu.

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

Remarques

L’opération de rotation consiste à multiplier la matrice de transformation par une matrice dont les éléments sont dérivés du paramètre angle. Cette méthode applique la rotation en la préparant à la matrice de transformation.

S’applique à

RotateTransform(Single, MatrixOrder)

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

Applique la rotation spécifiée à la matrice de transformation de cette Graphics dans l’ordre spécifié.

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)

Paramètres

angle
Single

Angle de rotation en degrés.

order
MatrixOrder

Membre de l’énumération MatrixOrder qui spécifie si la rotation est ajoutée ou précédée de la transformation de matrice.

Exemples

L’exemple de code suivant est conçu pour être utilisé avec Windows Forms et nécessite PaintEventArgse, qui est un paramètre du gestionnaire d’événements Paint. Le code effectue les actions suivantes :

  • Traduit la matrice de transformation mondiale du Windows Form par le vecteur (100, 0).

  • Fait pivoter la transformation du monde à l’aide d’un angle de 30 degrés, en ajoutant la matrice de rotation à la matrice de transformation mondiale avec Append.

  • Dessine un ellipse traduit et pivoté avec un stylet bleu.

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

Remarques

L’opération de rotation consiste à multiplier la matrice de transformation par une matrice dont les éléments sont dérivés du paramètre angle. Cette méthode précède ou ajoute la matrice de transformation de l'Graphics par la matrice de rotation en fonction du paramètre order.

S’applique à