## 重载

 MultiplyTransform(Matrix) 通过画笔的变换矩阵与其他的矩阵相乘的乘积更新该画笔的变换矩阵。Updates the brush's transformation matrix with the product of brush's transformation matrix multiplied by another matrix. MultiplyTransform(Matrix, MatrixOrder) 通过画笔的变换矩阵与其他的矩阵相乘的乘积更新该画笔的变换矩阵。Updates the brush's transformation matrix with the product of the brush's transformation matrix multiplied by another matrix.

## MultiplyTransform(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``

matrix
Matrix

## MultiplyTransform(Matrix, MatrixOrder)

``````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``

matrix
Matrix

order
MatrixOrder

### 示例

• 创建图形路径并向其添加一个矩形。Creates a graphics path and adds a rectangle to it.

• 从路径点创建一个 PathGradientBrush （在此示例中，点构成一个矩形，但它可以是大多数形状）。Creates a PathGradientBrush from the path points (in this example, the points form a rectangle, but it could be most any shape).

• 将中间颜色设置为红色，将周围颜色设置为蓝色。Sets the center color to red and the surrounding color to blue.

• 在应用乘变换之前，将 PathGradientBrush 绘制到屏幕上。Draws the PathGradientBrush to the screen prior to applying the multiply transform.

• 创建将画笔90旋转的矩阵，并在两个轴将其转换为100。Creates s matrix that rotates the brush 90 degrees and translates it by 100 in both axes.

• 使用 MultiplyTransform 方法将此矩阵应用于画笔。Applies this matrix to the brush by using the MultiplyTransform method.

• 在屏幕上绘制画笔。Draws the brush to the screen.

``````public:
void MultiplyTransformExample( PaintEventArgs^ e )
{
// Create a graphics path and add an rectangle.
GraphicsPath^ myPath = gcnew GraphicsPath;
Rectangle rect = Rectangle(20,20,100,50);

// Get the path's array of points.
array<PointF>^myPathPointArray = myPath->PathPoints;

// Create a path gradient brush.

// Set the color span.
myPGBrush->CenterColor = Color::Red;
array<Color>^ mySurroundColor = {Color::Blue};
myPGBrush->SurroundColors = mySurroundColor;

// Draw the brush to the screen prior to transformation.
e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 );

// Create a new matrix that rotates by 90 degrees, and
// translates by 100 in each direction.
Matrix^ myMatrix = gcnew Matrix( 0,1,-1,0,100,100 );

// Apply the transform to the brush.
myPGBrush->MultiplyTransform( myMatrix, MatrixOrder::Append );

// Draw the brush to the screen again after applying the
// transform.
e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 300 );
}
``````
``````public void MultiplyTransformExample(PaintEventArgs e)
{

// Create a graphics path and add an rectangle.
GraphicsPath myPath = new GraphicsPath();
Rectangle rect = new Rectangle(20, 20, 100, 50);

// Get the path's array of points.
PointF[] myPathPointArray = myPath.PathPoints;

// Create a path gradient brush.

// Set the color span.
myPGBrush.CenterColor = Color.Red;
Color[] mySurroundColor = {Color.Blue};
myPGBrush.SurroundColors = mySurroundColor;

// Draw the brush to the screen prior to transformation.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200);

// Create a new matrix that rotates by 90 degrees, and
// translates by 100 in each direction.
Matrix myMatrix = new Matrix(0, 1, -1, 0, 100, 100);

// Apply the transform to the brush.
myPGBrush.MultiplyTransform(myMatrix, MatrixOrder.Append);

// Draw the brush to the screen again after applying the
// transform.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 300);
}
``````
``````Public Sub MultiplyTransformExample(ByVal e As PaintEventArgs)

' Create a graphics path and add a rectangle.
Dim myPath As New GraphicsPath
Dim rect As New Rectangle(20, 20, 100, 50)

' Get the path's array of points.
Dim myPathPointArray As PointF() = myPath.PathPoints

' Create a path gradient brush.

' Set the color span.
myPGBrush.CenterColor = Color.Red
Dim mySurroundColor As Color() = {Color.Blue}
myPGBrush.SurroundColors = mySurroundColor

' Draw the brush to the screen prior to transformation.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200)

' Create a new matrix that rotates by 90 degrees, and
' translates by 100 in each direction.
Dim myMatrix As New Matrix(0, 1, -1, 0, 100, 100)

' Apply the transform to the brush.
myPGBrush.MultiplyTransform(myMatrix, MatrixOrder.Append)

' Draw the brush to the screen again after applying the
' transform.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 300)
End Sub
``````