Pen.MultiplyTransform 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
MultiplyTransform(Matrix) | |
MultiplyTransform(Matrix, MatrixOrder) |
MultiplyTransform(Matrix)
- Source:
- Pen.cs
- Source:
- Pen.cs
- Source:
- 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 窗体 一起使用,它需要 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
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 窗体 一起使用,它需要 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
追加或追加) 来执行乘法运算。
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈