Graphics.RotateTransform Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Applique la rotation spécifiée à la matrice de transformation de ce Graphics.
Surcharges
RotateTransform(Single) |
Applique la rotation spécifiée à la matrice de transformation de ce Graphics. |
RotateTransform(Single, MatrixOrder) |
Applique la rotation spécifiée à la matrice de transformation de ce Graphics dans l'ordre indiqué. |
RotateTransform(Single)
Applique la rotation spécifiée à la matrice de transformation de ce 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 Paint gestionnaire d’événements. Le code effectue les actions suivantes :
Traduit la matrice de transformation du monde du Windows Form par le vecteur (100, 0).
Effectue une rotation de la transformation du monde d’un angle de 30 degrés, ce qui précède la matrice de rotation pour la matrice de transformation du monde.
Dessine une ellipse pivotée et traduite 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 angle
paramètre. Cette méthode applique la rotation en la préparant à la matrice de transformation.
S’applique à
RotateTransform(Single, MatrixOrder)
Applique la rotation spécifiée à la matrice de transformation de ce Graphics dans l'ordre indiqué.
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 au début ou à la fin de la matrice de transformation.
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 Paint gestionnaire d’événements. Le code effectue les actions suivantes :
Traduit la matrice de transformation du monde du Windows Form par le vecteur (100, 0).
Fait pivoter la transformation du monde d’un angle de 30 degrés, ajoutant la matrice de rotation à la matrice de transformation du monde avec Append.
Dessine une ellipse convertie et pivotée 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 angle
paramètre. Cette méthode ajoute ou ajoute la matrice de transformation de par Graphics la matrice de rotation en fonction du order
paramètre .
S’applique à
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : tout au long de 2024, nous allons éliminer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d'informations, consultez :Envoyer et afficher des commentaires pour