Matrix.Rotate 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.
Effectue une rotation égale à l'angle spécifié dans le sens des aiguilles d'une montre, par rapport à l'origine de ce Matrix.
Surcharges
Rotate(Single) |
Ajoute une rotation égale à l'angle spécifié, dans le sens des aiguilles d'une montre et par rapport à l'origine, au début de ce Matrix. |
Rotate(Single, MatrixOrder) |
Applique une rotation égale à la valeur spécifiée par le paramètre |
Rotate(Single)
- Source:
- Matrix.cs
- Source:
- Matrix.cs
- Source:
- Matrix.cs
Ajoute une rotation égale à l'angle spécifié, dans le sens des aiguilles d'une montre et par rapport à l'origine, au début de ce Matrix.
public:
void Rotate(float angle);
public void Rotate (float angle);
member this.Rotate : single -> unit
Public Sub Rotate (angle As Single)
Paramètres
- angle
- Single
Angle de la rotation, en degrés.
Exemples
Pour obtenir un exemple, consultez Rotate(Single, MatrixOrder).
S’applique à
Rotate(Single, MatrixOrder)
- Source:
- Matrix.cs
- Source:
- Matrix.cs
- Source:
- Matrix.cs
Applique une rotation égale à la valeur spécifiée par le paramètre angle
, dans le sens des aiguilles d'une montre et par rapport à l'origine (coordonnées x et y égales à zéro), pour ce Matrix.
public:
void Rotate(float angle, System::Drawing::Drawing2D::MatrixOrder order);
public void Rotate (float angle, System.Drawing.Drawing2D.MatrixOrder order);
member this.Rotate : single * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub Rotate (angle As Single, order As MatrixOrder)
Paramètres
- angle
- Single
Angle (étendue) de la rotation, en degrés.
- order
- MatrixOrder
MatrixOrder qui spécifie l'ordre (ajout au début ou à la fin) dans lequel la rotation est appliquée à ce Matrix.
Exemples
L’exemple de code suivant est conçu pour être utilisé avec Windows Forms et nécessite PaintEventArgse
, un objet d’événementPaint. Le code effectue les actions suivantes :
Dessine un rectangle vers l’écran avant d’appliquer une transformation de rotation (rectangle bleu).
Crée une matrice et la fait pivoter de 45 degrés.
Applique cette transformation de matrice au rectangle.
Dessine le rectangle transformé à l’écran (rectangle rouge).
Notez que le rectangle rouge a été pivoté autour des coordonnées d’écran 0, 0.
public:
void RotateExample( PaintEventArgs^ e )
{
Pen^ myPen = gcnew Pen( Color::Blue,1.0f );
Pen^ myPen2 = gcnew Pen( Color::Red,1.0f );
// Draw the rectangle to the screen before applying the transform.
e->Graphics->DrawRectangle( myPen, 150, 50, 200, 100 );
// Create a matrix and rotate it 45 degrees.
Matrix^ myMatrix = gcnew Matrix;
myMatrix->Rotate( 45, MatrixOrder::Append );
// Draw the rectangle to the screen again after applying the
// transform.
e->Graphics->Transform = myMatrix;
e->Graphics->DrawRectangle( myPen2, 150, 50, 200, 100 );
}
public void RotateExample(PaintEventArgs e)
{
Pen myPen = new Pen(Color.Blue, 1);
Pen myPen2 = new Pen(Color.Red, 1);
// Draw the rectangle to the screen before applying the transform.
e.Graphics.DrawRectangle(myPen, 150, 50, 200, 100);
// Create a matrix and rotate it 45 degrees.
Matrix myMatrix = new Matrix();
myMatrix.Rotate(45, MatrixOrder.Append);
// Draw the rectangle to the screen again after applying the
// transform.
e.Graphics.Transform = myMatrix;
e.Graphics.DrawRectangle(myPen2, 150, 50, 200, 100);
}
Public Sub RotateExample(ByVal e As PaintEventArgs)
Dim myPen As New Pen(Color.Blue, 1)
Dim myPen2 As New Pen(Color.Red, 1)
' Draw the rectangle to the screen before applying the transform.
e.Graphics.DrawRectangle(myPen, 150, 50, 200, 100)
' Create a matrix and rotate it 45 degrees.
Dim myMatrix As New Matrix
myMatrix.Rotate(45, MatrixOrder.Append)
' Draw the rectangle to the screen again after applying the
' transform.
e.Graphics.Transform = myMatrix
e.Graphics.DrawRectangle(myPen2, 150, 50, 200, 100)
End Sub
S’applique à
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer 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, consultezEnvoyer et afficher des commentaires pour