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
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 Forms,它需要 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

注解

参数的值Prependorder指定乘法的顺序为 matrix x 世界转换。 Append一个值,该值order指定乘法的顺序是世界转换 x matrix

另请参阅

适用于

MultiplyTransform(Matrix)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
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 Forms,它需要 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 world 转换。

另请参阅

适用于