Partager via


Graphics.MultiplyTransform Méthode

Définition

Multiplie la transformation mondiale de cette Graphics et spécifie le Matrix.

Surcharges

MultiplyTransform(Matrix)

Multiplie la transformation mondiale de cette Graphics et spécifie le Matrix.

MultiplyTransform(Matrix, MatrixOrder)

Multiplie la transformation mondiale de cette Graphics et spécifie la Matrix dans l’ordre spécifié.

MultiplyTransform(Matrix)

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

Multiplie la transformation mondiale de cette Graphics et spécifie le Matrix.

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

matrix
Matrix

4x4 Matrix qui multiplie la transformation du monde.

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 :

  • Crée une matrice transformMatrix (deux par deux matrices d’identité et un vecteur de traduction zéro).

  • Traduit la matrice de transformation par un vecteur (200, 100).

  • Fait pivoter la matrice de transformation du monde du Windows Form de 30 degrés, prépendait la matrice de rotation pour 30 degrés à la matrice de transformation du formulaire.

  • Multiplie la matrice de transformation du monde pivotée par le transformMatrixtraduit et prépende la transformMatrix à la matrice de transformation du monde.

  • Dessine un ellipse pivoté et traduit.

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 précède la matrice spécifiée par le paramètre matrix, afin que le résultat soit matrix transformation du monde x.

Voir aussi

S’applique à

MultiplyTransform(Matrix, MatrixOrder)

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

Multiplie la transformation mondiale de cette Graphics et spécifie la Matrix dans l’ordre spécifié.

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

matrix
Matrix

4x4 Matrix qui multiplie la transformation du monde.

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 gestionnaire d’événements Paint. Le code effectue les actions suivantes :

  • Crée une matrice transformMatrix (deux par deux matrices d’identité et un vecteur de traduction zéro).

  • Traduit la matrice de transformation par un vecteur (200, 100).

  • Fait pivoter la matrice de transformation du monde du Windows Form de 30 degrés, ce qui précède la matrice de rotation de 30 degrés à la matrice de transformation du formulaire.

  • Multiplie la matrice de transformation du monde pivotée par le transformMatrixtraduit, ajoutant la transformMatrix à la matrice de transformation mondiale.

  • Dessine un ellipse pivoté et traduit.

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 paramètre order spécifie que l’ordre de la multiplication est matrix transformation du monde x. Une valeur de Append pour order spécifie que l’ordre de la multiplication est la transformation du monde x matrix.

Voir aussi

S’applique à