Graphics.MultiplyTransform Metoda

Definicja

Mnoży świat transformacji tego Graphics elementu i określił wartość Matrix.

Przeciążenia

MultiplyTransform(Matrix)

Mnoży świat transformacji tego Graphics elementu i określił wartość Matrix.

MultiplyTransform(Matrix, MatrixOrder)

Mnoży transformację świata i Graphics określono Matrix w określonej kolejności.

MultiplyTransform(Matrix)

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Mnoży świat transformacji tego Graphics elementu i określił wartość 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)

Parametry

matrix
Matrix

4x4 Matrix , który mnoży transformację świata.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • transformMatrix Tworzy macierz (dwie według dwóch macierzy tożsamości oraz wektor z zerowym tłumaczeniem).

  • Tłumaczy macierz przekształcania według wektora (200, 100).

  • Obraca macierz transformacji świata formularza systemu Windows o 30 stopni, poprzedza macierz rotacji przez 30 stopni do macierzy transformacji formularza.

  • Mnoży obróconą macierz transformacji świata przez przetłumaczoną transformMatrixwartość , a następnie poprzedza transformMatrix macierz transformacji świata.

  • Rysuje obrócony, przetłumaczony wielokropek.

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

Uwagi

Ta metoda poprzedza macierz określoną przez matrix parametr, tak aby wynik był matrix x transformacją świata.

Zobacz też

Dotyczy

MultiplyTransform(Matrix, MatrixOrder)

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Mnoży transformację świata i Graphics określono Matrix w określonej kolejności.

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)

Parametry

matrix
Matrix

4x4 Matrix , który mnoży transformację świata.

order
MatrixOrder

Element członkowski wyliczenia MatrixOrder , który określa kolejność mnożenia.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • transformMatrix Tworzy macierz (dwie według dwóch macierzy tożsamości oraz wektor z zerowym tłumaczeniem).

  • Tłumaczy macierz przekształcania według wektora (200, 100).

  • Obraca macierz transformacji świata formularza systemu Windows o 30 stopni, co poprzedza macierz rotacji dla 30 stopni do macierzy transformacji formularza.

  • Mnoży obróconą macierz transformacji świata przez przetłumaczony transformMatrixelement , dołączając transformMatrix element do macierzy transformacji świata.

  • Rysuje obrócony, przetłumaczony wielokropek.

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

Uwagi

Wartość Prepend parametru order określa, że kolejność mnożenia to matrix x transformacja świata. Wartość Append dla order określa, że kolejność mnożenia to transformacja świata x matrix.

Zobacz też

Dotyczy