Graphics.MultiplyTransform 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.
Surcharges
MultiplyTransform(Matrix) |
Multiplie la transformation universelle de ce Graphics et spécifie l'objet Matrix. |
MultiplyTransform(Matrix, MatrixOrder) |
Multiplie la transformation universelle de ce Graphics et spécifie Matrix dans l'ordre indiqué. |
MultiplyTransform(Matrix)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
public:
void MultiplyTransform(System::Drawing::Drawing2D::Matrix ^ matrix);
public void MultiplyTransform (System.Drawing.Drawing2D.Matrix matrix);
member this.MultiplyTransform : System.Drawing.Drawing2D.Matrix -> unit
Public Sub MultiplyTransform (matrix As Matrix)
Paramètres
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 :
Crée une
transformMatrix
matrice (une matrice d’identité deux par deux plus un vecteur de traduction zéro).Traduit la matrice de transformation par un vecteur (200, 100).
Fait pivoter de 30 degrés la matrice de transformation mondiale du Windows Form, ajoute la matrice de rotation de 30 degrés à la matrice de transformation du formulaire.
Multiplie la matrice de transformation de monde pivotée par le traduit
transformMatrix
et ajoute à latransformMatrix
matrice de transformation du monde.Dessine une ellipse pivotée et traduite.
public:
void MultiplyTransformMatrix( PaintEventArgs^ e )
{
// Create transform matrix.
Matrix^ transformMatrix = gcnew Matrix;
// Translate matrix, prepending translation vector.
transformMatrix->Translate( 200.0F, 100.0F );
// Rotate transformation matrix of graphics object,
// prepending rotation matrix.
e->Graphics->RotateTransform( 30.0F );
// Multiply (prepend to) transformation matrix of
// graphics object to translate graphics transformation.
e->Graphics->MultiplyTransform( transformMatrix );
// Draw rotated, translated ellipse.
e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), -80, -40, 160, 80 );
}
private void MultiplyTransformMatrix(PaintEventArgs e)
{
// Create transform matrix.
Matrix transformMatrix = new Matrix();
// Translate matrix, prepending translation vector.
transformMatrix.Translate(200.0F, 100.0F);
// Rotate transformation matrix of graphics object,
// prepending rotation matrix.
e.Graphics.RotateTransform(30.0F);
// Multiply (prepend to) transformation matrix of
// graphics object to translate graphics transformation.
e.Graphics.MultiplyTransform(transformMatrix);
// Draw rotated, translated ellipse.
e.Graphics.DrawEllipse(new Pen(Color.Blue, 3), -80, -40, 160, 80);
}
Private Sub MultiplyTransformMatrix(ByVal e As PaintEventArgs)
' Create transform matrix.
Dim transformMatrix As New Matrix
' Translate matrix, prepending translation vector.
transformMatrix.Translate(200.0F, 100.0F)
' Rotate transformation matrix of graphics object,
' prepending rotation matrix.
e.Graphics.RotateTransform(30.0F)
' Multiply (prepend to) transformation matrix of
' graphics object to translate graphics transformation.
e.Graphics.MultiplyTransform(transformMatrix)
' Draw rotated, translated ellipse.
e.Graphics.DrawEllipse(New Pen(Color.Blue, 3), -80, -40, 160, 80)
End Sub
Remarques
Cette méthode ajoute la matrice spécifiée par le matrix
paramètre , de sorte que le résultat est matrix
x transformation de monde.
Voir aussi
S’applique à
MultiplyTransform(Matrix, MatrixOrder)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
public:
void MultiplyTransform(System::Drawing::Drawing2D::Matrix ^ matrix, System::Drawing::Drawing2D::MatrixOrder order);
public void MultiplyTransform (System.Drawing.Drawing2D.Matrix matrix, System.Drawing.Drawing2D.MatrixOrder order);
member this.MultiplyTransform : System.Drawing.Drawing2D.Matrix * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub MultiplyTransform (matrix As Matrix, order As MatrixOrder)
Paramètres
- order
- MatrixOrder
Membre de l'énumération MatrixOrder qui détermine l'ordre de la multiplication.
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 :
Crée une
transformMatrix
matrice (une matrice d’identité deux par deux plus un vecteur de traduction zéro).Traduit la matrice de transformation par un vecteur (200, 100).
Fait pivoter de 30 degrés la matrice de transformation de monde du Windows Form, avant la matrice de rotation de 30 degrés dans la matrice de transformation du formulaire.
Multiplie la matrice de transformation de monde pivotée par le traduit
transformMatrix
, en ajoutant àtransformMatrix
la matrice de transformation de monde.Dessine une ellipse pivotée et traduite.
public:
void MultiplyTransformMatrixOrder( PaintEventArgs^ e )
{
// Create transform matrix.
Matrix^ transformMatrix = gcnew Matrix;
// Translate matrix, prepending translation vector.
transformMatrix->Translate( 200.0F, 100.0F );
// Rotate transformation matrix of graphics object,
// prepending rotation matrix.
e->Graphics->RotateTransform( 30.0F );
// Multiply (append to) transformation matrix of
// graphics object to translate graphics transformation.
e->Graphics->MultiplyTransform( transformMatrix, MatrixOrder::Append );
// Draw rotated, translated ellipse.
e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), -80, -40, 160, 80 );
}
private void MultiplyTransformMatrixOrder(PaintEventArgs e)
{
// Create transform matrix.
Matrix transformMatrix = new Matrix();
// Translate matrix, prepending translation vector.
transformMatrix.Translate(200.0F, 100.0F);
// Rotate transformation matrix of graphics object,
// prepending rotation matrix.
e.Graphics.RotateTransform(30.0F);
// Multiply (append to) transformation matrix of
// graphics object to translate graphics transformation.
e.Graphics.MultiplyTransform(transformMatrix, MatrixOrder.Append);
// Draw rotated, translated ellipse.
e.Graphics.DrawEllipse(new Pen(Color.Blue, 3), -80, -40, 160, 80);
}
Private Sub MultiplyTransformMatrixOrder(ByVal e As PaintEventArgs)
' Create transform matrix.
Dim transformMatrix As New Matrix
' Translate matrix, prepending translation vector.
transformMatrix.Translate(200.0F, 100.0F)
' Rotate transformation matrix of graphics object,
' prepending rotation matrix.
e.Graphics.RotateTransform(30.0F)
' Multiply (append to) transformation matrix of
' graphics object to translate graphics transformation.
e.Graphics.MultiplyTransform(transformMatrix, MatrixOrder.Append)
' Draw rotated, translated ellipse.
e.Graphics.DrawEllipse(New Pen(Color.Blue, 3), -80, -40, 160, 80)
End Sub
Remarques
Une valeur de Prepend pour le order
paramètre spécifie que l’ordre de la multiplication est matrix
x transformation de monde. La valeur de Append pour order
spécifie que l’ordre de la multiplication est la transformation de monde x matrix
.
Voir aussi
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