Pen.MultiplyTransform 方法

定義

將這個 Pen 的轉換矩陣乘以指定的 Matrix

多載

MultiplyTransform(Matrix)

將這個 Pen 的轉換矩陣乘以指定的 Matrix

MultiplyTransform(Matrix, MatrixOrder)

依照指定的順序,將這個 Pen 的轉換矩陣乘以指定的 Matrix

MultiplyTransform(Matrix)

來源:
Pen.cs
來源:
Pen.cs
來源:
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 Forms 使用,而且需要 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)

來源:
Pen.cs
來源:
Pen.cs
來源:
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 Forms 使用,而且需要 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

備註

這個方法會 MatrixOrder 使用列舉專案 (前面加上或附加參數所 order 指定的) ,以執行乘法運算。

適用於