TextureBrush.MultiplyTransform 方法

定义

将表示此 TextureBrush 对象的局部几何转换的 Matrix 对象与指定的 Matrix 对象按指定顺序相乘。Multiplies the Matrix object that represents the local geometric transformation of this TextureBrush object by the specified Matrix object in the specified order.

重载

MultiplyTransform(Matrix, MatrixOrder)

将表示此 TextureBrush 对象的局部几何转换的 Matrix 对象与指定的 Matrix 对象按指定顺序相乘。Multiplies the Matrix object that represents the local geometric transformation of this TextureBrush object by the specified Matrix object in the specified order.

MultiplyTransform(Matrix)

通过预先计算指定的 Matrix 对象,将表示此 TextureBrush 对象的局部几何转换的 Matrix 对象与指定 Matrix 对象相乘。Multiplies the Matrix object that represents the local geometric transformation of this TextureBrush object by the specified Matrix object by prepending the specified Matrix object.

MultiplyTransform(Matrix, MatrixOrder)

将表示此 TextureBrush 对象的局部几何转换的 Matrix 对象与指定的 Matrix 对象按指定顺序相乘。Multiplies the Matrix object that represents the local geometric transformation of this TextureBrush object by the specified Matrix object in the specified order.

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 对象。The Matrix object by which to multiply the geometric transformation.

order
MatrixOrder

用于指定两个矩阵相乘的顺序的 MatrixOrder 枚举。A MatrixOrder enumeration that specifies the order in which to multiply the two matrices.

示例

下面的示例旨在与 Windows 窗体一起使用,并且它需要作为 PaintEventArgs e Paint 事件处理程序的参数。The following example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. 此代码执行以下操作:The code performs the following actions:

  • 创建一个 TextureBrush 对象。Creates a TextureBrush object.

  • 创建一个新矩阵,该矩阵指定 x 方向上50个单位的平移。Creates a new matrix that specifies a translation of 50 units in the x-direction.

  • 将矩阵与纹理画笔的变换矩阵相乘。Multiplies the matrix with the transformation matrix of the texture brush.

  • 使用纹理画笔填充矩形。Fills a rectangle, using the texture brush.

void MultiplyTransform_Example2( PaintEventArgs^ e )
{
   // Create a TextureBrush object.
   TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) );

   // Create a transformation matrix.
   Matrix^ translateMatrix = gcnew Matrix;
   translateMatrix->Translate( 50, 0 );

   // Multiply the transformation matrix of tBrush by translateMatrix.
   tBrush->MultiplyTransform( translateMatrix );

   // Fill a rectangle with tBrush.
   e->Graphics->FillRectangle( tBrush, 0, 110, 100, 100 );
}
public void MultiplyTransform_Example2(PaintEventArgs e)
{
             
    // Create a TextureBrush object.
    TextureBrush tBrush = new TextureBrush(new Bitmap("texture.jpg"));
             
    // Create a transformation matrix.
    Matrix translateMatrix = new Matrix();
    translateMatrix.Translate(50, 0);
             
    // Multiply the transformation matrix of tBrush by translateMatrix.
    tBrush.MultiplyTransform(translateMatrix);
             
    // Fill a rectangle with tBrush.
    e.Graphics.FillRectangle(tBrush, 0, 110, 100, 100);
}
Public Sub MultiplyTransform_Example2(ByVal e As PaintEventArgs)

    ' Create a TextureBrush object.
    Dim tBrush As New TextureBrush(New Bitmap("texture.jpg"))

    ' Create a transformation matrix.
    Dim translateMatrix As New Matrix
    translateMatrix.Translate(50, 0)

    ' Multiply the transformation matrix of tBrush by translateMatrix.
    tBrush.MultiplyTransform(translateMatrix)

    ' Fill a rectangle with tBrush.
    e.Graphics.FillRectangle(tBrush, 0, 110, 100, 100)
End Sub

注解

对象的转换矩阵 TextureBrush 指定如何转换定义纹理的图像。The transformation matrix of a TextureBrush object specifies how the image that defines the texture is transformed. 例如,如果变换矩阵指定了顺时针旋转90度,纹理图像将会顺时针旋转90度。For example, if the transformation matrix specifies a rotation of 90 degrees clockwise, the texture image is rotated by 90 degrees clockwise.

适用于

MultiplyTransform(Matrix)

通过预先计算指定的 Matrix 对象,将表示此 TextureBrush 对象的局部几何转换的 Matrix 对象与指定 Matrix 对象相乘。Multiplies the Matrix object that represents the local geometric transformation of this TextureBrush object by the specified Matrix object by prepending the specified Matrix object.

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 对象。The Matrix object by which to multiply the geometric transformation.

示例

下面的示例旨在与 Windows 窗体一起使用,并且它需要作为 PaintEventArgs e Paint 事件处理程序的参数。The following example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. 此代码执行以下操作:The code performs the following actions:

  • 创建一个 TextureBrush 对象。Creates a TextureBrush object.

  • 创建一个新矩阵,该矩阵指定 x 方向上50个单位的平移。Creates a new matrix that specifies a translation of 50 units in the x-direction.

  • 将矩阵与纹理画笔的变换矩阵相乘。Multiplies the matrix with the transformation matrix of the texture brush.

  • 使用纹理画笔填充矩形。Fills a rectangle, using the texture brush.

public:
   void MultiplyTransform_Example1( PaintEventArgs^ e )
   {
      // Create a TextureBrush object.
      TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) );

      // Create a transformation matrix.
      Matrix^ translateMatrix = gcnew Matrix;
      translateMatrix->Translate( 50, 0 );

      // Multiply the transformation matrix of tBrush by translateMatrix.
      tBrush->MultiplyTransform( translateMatrix, MatrixOrder::Prepend );

      // Fill a rectangle with tBrush.
      e->Graphics->FillRectangle( tBrush, 0, 110, 100, 100 );
   }
public void MultiplyTransform_Example1(PaintEventArgs e)
{
             
    // Create a TextureBrush object.
    TextureBrush tBrush = new TextureBrush(new Bitmap("texture.jpg"));
             
    // Create a transformation matrix.
    Matrix translateMatrix = new Matrix();
    translateMatrix.Translate(50, 0);
             
    // Multiply the transformation matrix of tBrush by translateMatrix.
    tBrush.MultiplyTransform(translateMatrix, MatrixOrder.Prepend);
             
    // Fill a rectangle with tBrush.
    e.Graphics.FillRectangle(tBrush, 0, 110, 100, 100);
}
Public Sub MultiplyTransform_Example1(ByVal e As PaintEventArgs)

    ' Create a TextureBrush object.
    Dim tBrush As New TextureBrush(New Bitmap("texture.jpg"))

    ' Create a transformation matrix.
    Dim translateMatrix As New Matrix
    translateMatrix.Translate(50, 0)

    ' Multiply the transformation matrix of tBrush by translateMatrix.
    tBrush.MultiplyTransform(translateMatrix, MatrixOrder.Prepend)

    ' Fill a rectangle with tBrush.
    e.Graphics.FillRectangle(tBrush, 0, 110, 100, 100)
End Sub

注解

对象的转换矩阵 TextureBrush 指定如何转换定义纹理的图像。The transformation matrix of a TextureBrush object specifies how the image that defines the texture is transformed. 例如,如果变换矩阵指定了顺时针旋转90度,纹理图像将会顺时针旋转90度。For example, if the transformation matrix specifies a rotation of 90 degrees clockwise, the texture image is rotated by 90 degrees clockwise.

适用于