Graphics.MultiplyTransform 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
MultiplyTransform(Matrix, MatrixOrder) | |
MultiplyTransform(Matrix) |
MultiplyTransform(Matrix, MatrixOrder)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.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
決定乘法順序之 MatrixOrder 列舉的成員。
範例
下列程式代碼範例是專為搭配 Windows Forms 使用而設計,而且需要 PaintEventArgse
,這是 Paint 事件處理程式的參數。 程式代碼會執行下列動作:
建立
transformMatrix
矩陣(兩個乘以兩個識別矩陣加上零轉譯向量)。依向量轉譯轉換矩陣 (200, 100)。
將 Windows Form 的世界轉換矩陣旋轉 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 世界轉換。
order
的 Append 值指定乘法的順序是世界轉換 x matrix
。
另請參閱
適用於
MultiplyTransform(Matrix)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.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 事件處理程式的參數。 程式代碼會執行下列動作:
建立
transformMatrix
矩陣(兩個乘以兩個識別矩陣加上零轉譯向量)。依向量轉譯轉換矩陣 (200, 100)。
將 Windows Form 的世界轉換矩陣旋轉 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 世界轉換。