TextureBrush.ResetTransform Method ()

 

Resets the Transform property of this TextureBrush object to identity.

Namespace:   System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

public void ResetTransform()

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.

  • Rotates the texture image by 90 degrees.

  • Fills a rectangle.

  • Resets the transformation matrix to identity.

  • Fills a second rectangle.

public void ResetTransform_Example(PaintEventArgs e)
{

    // Create a TextureBrush object.
    TextureBrush tBrush = new TextureBrush(new Bitmap("texture.jpg"));

    // Rotate the texture image by 90 degrees.
    tBrush.RotateTransform(90);

    // Fill a rectangle with tBrush.
    e.Graphics.FillRectangle(tBrush, 0, 0, 100, 100);

    // Reset transformation matrix to identity.
    tBrush.ResetTransform();

    // Fill a rectangle with tBrush.
    e.Graphics.FillRectangle(tBrush, 0, 110, 100, 100);
}

.NET Framework
Available since 1.1
Return to top
Show: