Pen.MultiplyTransform 方法

定义

将此 Pen 的转换矩阵乘以指定的 Matrix

重载

MultiplyTransform(Matrix)

将此 Pen 的转换矩阵乘以指定的 Matrix

MultiplyTransform(Matrix, MatrixOrder)

将此 Pen 的转换矩阵乘以指定顺序的指定 Matrix

MultiplyTransform(Matrix)

Source:
Pen.cs
Source:
Pen.cs
Source:
Pen.cs
Source:
Pen.cs
Source:
Pen.cs

将此 Pen 的转换矩阵乘以指定的 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

要乘以转换矩阵的 Matrix 对象。

示例

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

  • 创建 Pen

  • 将线条绘制到屏幕。

  • 将笔的转换矩阵乘以指定的矩阵。

  • 使用转换后的笔绘制线条。

public:
   void MultiplyTransform_Example1( PaintEventArgs^ e )
   {
      
      // Create a Pen object.
      Pen^ myPen = gcnew Pen( Color::Black,5.0f );
      
      // Create a translation matrix.
      Matrix^ penMatrix = gcnew Matrix;
      penMatrix->Scale( 3, 1 );
      
      // Multiply the transformation matrix of myPen by transMatrix.
      myPen->MultiplyTransform( penMatrix );
      
      // Draw a line to the screen.
      e->Graphics->DrawLine( myPen, 0, 0, 100, 100 );
   }
public void MultiplyTransform_Example1(PaintEventArgs e)
{
             
    // Create a Pen object.
    Pen myPen = new Pen(Color.Black, 5);
             
    // Create a translation matrix.
    Matrix penMatrix = new Matrix();
    penMatrix.Scale(3, 1);
             
    // Multiply the transformation matrix of myPen by transMatrix.
    myPen.MultiplyTransform(penMatrix);
             
    // Draw a line to the screen.
    e.Graphics.DrawLine(myPen, 0, 0, 100, 100);
}
Public Sub MultiplyTransform_Example1(ByVal e As PaintEventArgs)

    ' Create a Pen object.
    Dim myPen As New Pen(Color.Black, 5)

    ' Create a translation matrix.
    Dim penMatrix As New Matrix
    penMatrix.Scale(3, 1)

    ' Multiply the transformation matrix of myPen by transMatrix.
    myPen.MultiplyTransform(penMatrix)

    ' Draw a line to the screen.
    e.Graphics.DrawLine(myPen, 0, 0, 100, 100)
End Sub

注解

此方法将 matrix 参数中指定的乘法矩阵追加到乘法运算的转换矩阵。

适用于

MultiplyTransform(Matrix, MatrixOrder)

Source:
Pen.cs
Source:
Pen.cs
Source:
Pen.cs
Source:
Pen.cs
Source:
Pen.cs

将此 Pen 的转换矩阵乘以指定顺序的指定 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

要乘以转换矩阵的 Matrix

order
MatrixOrder

执行乘法运算的顺序。

示例

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

  • 创建 Pen

  • 将线条绘制到屏幕。

  • 将笔的转换矩阵乘以指定的矩阵。

  • 使用转换后的笔绘制线条。

public:
   void MultiplyTransform_Example2( PaintEventArgs^ e )
   {
      
      // Create a Pen object.
      Pen^ myPen = gcnew Pen( Color::Black,5.0f );
      
      // Create a translation matrix.
      Matrix^ penMatrix = gcnew Matrix;
      penMatrix->Scale( 3, 1 );
      
      // Multiply the transformation matrix of myPen by transMatrix.
      myPen->MultiplyTransform( penMatrix, MatrixOrder::Prepend );
      
      // Draw a line to the screen.
      e->Graphics->DrawLine( myPen, 0, 0, 100, 100 );
   }
public void MultiplyTransform_Example2(PaintEventArgs e)
{
             
    // Create a Pen object.
    Pen myPen = new Pen(Color.Black, 5);
             
    // Create a translation matrix.
    Matrix penMatrix = new Matrix();
    penMatrix.Scale(3, 1);
             
    // Multiply the transformation matrix of myPen by transMatrix.
    myPen.MultiplyTransform(penMatrix, MatrixOrder.Prepend);
             
    // Draw a line to the screen.
    e.Graphics.DrawLine(myPen, 0, 0, 100, 100);
}
Public Sub MultiplyTransform_Example2(ByVal e As PaintEventArgs)

    ' Create a Pen object.
    Dim myPen As New Pen(Color.Black, 5)

    ' Create a translation matrix.
    Dim penMatrix As New Matrix
    penMatrix.Scale(3, 1)

    ' Multiply the transformation matrix of myPen by transMatrix.
    myPen.MultiplyTransform(penMatrix, MatrixOrder.Prepend)

    ' Draw a line to the screen.
    e.Graphics.DrawLine(myPen, 0, 0, 100, 100)
End Sub

注解

此方法使用由 order 参数指定的 MatrixOrder 枚举元素(追加或追加)来执行乘法运算。

适用于