Редагувати

Поділитися через


TextureBrush.MultiplyTransform Method

Definition

Multiplies the Matrix object that represents the local geometric transformation of this TextureBrush object by the specified Matrix object in the specified order.

Overloads

MultiplyTransform(Matrix, MatrixOrder)

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)

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)

Source:
TextureBrush.cs
Source:
TextureBrush.cs
Source:
TextureBrush.cs
Source:
TextureBrush.cs
Source:
TextureBrush.cs

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)

Parameters

matrix
Matrix

The Matrix object by which to multiply the geometric transformation.

order
MatrixOrder

A MatrixOrder enumeration that specifies the order in which to multiply the two matrices.

Examples

The following example is designed for use with Windows Forms, and it requires PaintEventArgs e, which is a parameter of the Paint event handler. The code performs the following actions:

  • Creates a TextureBrush object.

  • 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

Remarks

The transformation matrix of a TextureBrush object specifies how the image that defines the texture is transformed. For example, if the transformation matrix specifies a rotation of 90 degrees clockwise, the texture image is rotated by 90 degrees clockwise.

Applies to

MultiplyTransform(Matrix)

Source:
TextureBrush.cs
Source:
TextureBrush.cs
Source:
TextureBrush.cs
Source:
TextureBrush.cs
Source:
TextureBrush.cs

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)

Parameters

matrix
Matrix

The Matrix object by which to multiply the geometric transformation.

Examples

The following example is designed for use with Windows Forms, and it requires PaintEventArgs e, which is a parameter of the Paint event handler. The code performs the following actions:

  • Creates a TextureBrush object.

  • 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

Remarks

The transformation matrix of a TextureBrush object specifies how the image that defines the texture is transformed. For example, if the transformation matrix specifies a rotation of 90 degrees clockwise, the texture image is rotated by 90 degrees clockwise.

Applies to