Graphics.MultiplyTransform 方法

定义

将此 Graphics 的世界转换相乘,并指定 Matrix

重载

MultiplyTransform(Matrix, MatrixOrder)

将此 Graphics 的世界转换相乘,并按指定顺序指定 Matrix

MultiplyTransform(Matrix)

将此 Graphics 的世界转换相乘,并指定 Matrix

MultiplyTransform(Matrix, MatrixOrder)

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

将此 Graphics 的世界转换相乘,并按指定顺序指定 Matrix

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)

参数

matrix
Matrix

与世界转型相乘的 4x4 Matrix

order
MatrixOrder

确定乘法顺序的 MatrixOrder 枚举的成员。

示例

下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse,这是 Paint 事件处理程序的参数。 该代码执行以下操作:

  • 创建 transformMatrix 矩阵(两个乘以两个标识矩阵加上零转换向量)。

  • 按向量转换转换矩阵(200,100)。

  • 将 Windows 窗体的世界转换矩阵旋转 30 度,将旋转矩阵追加到窗体的转换矩阵前 30 度。

  • 将旋转的世界转换矩阵乘以转换 transformMatrix,并将 transformMatrix 追加到世界转换矩阵。

  • 绘制旋转的翻译椭圆。

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

注解

order 参数的 Prepend 值指定乘法的顺序 matrix x 世界转换。 orderAppend 值指定乘法的顺序是世界转换 x matrix

另请参阅

  • 转换 的 矩阵表示形式

适用于

MultiplyTransform(Matrix)

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

将此 Graphics 的世界转换相乘,并指定 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)

参数

matrix
Matrix

与世界转型相乘的 4x4 Matrix

示例

下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse,这是 Paint 事件处理程序的参数。 该代码执行以下操作:

  • 创建 transformMatrix 矩阵(两个乘以两个标识矩阵加上零转换向量)。

  • 按向量转换转换矩阵(200,100)。

  • 将 Windows 窗体的世界转换矩阵旋转 30 度,在窗体的转换矩阵前面追加 30 度的旋转矩阵。

  • 将旋转的世界转换矩阵乘以转换 transformMatrix,并将 transformMatrix 追加到世界转换矩阵。

  • 绘制旋转的翻译椭圆。

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

注解

此方法将 matrix 参数指定的矩阵前面,以便结果 matrix x 世界转换。

另请参阅

  • 转换 的 矩阵表示形式

适用于