Pen.MultiplyTransform 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
MultiplyTransform(Matrix) | |
MultiplyTransform(Matrix, MatrixOrder) |
MultiplyTransform(Matrix)
- 來源:
- Pen.cs
- 來源:
- Pen.cs
- 來源:
- Pen.cs
- 來源:
- Pen.cs
- 來源:
- Pen.cs
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)
參數
範例
下列程式代碼範例是專為搭配 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.cs
- 來源:
- Pen.cs
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)
參數
- 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
備註
這個方法會使用 order
參數所指定的 MatrixOrder 列舉專案(前面或附加)來執行乘法運算。