TextureBrush.Clone Method ()


Creates an exact copy of this TextureBrush object.

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

public override object Clone()

Return Value

Type: System.Object

The TextureBrush object this method creates, cast as an Object object.

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 creates a TextureBrush object and an exact copy of that texture brush, and then uses the copy to fill a rectangle on the screen.

public void Clone_Example(PaintEventArgs e)

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

    // Create an exact copy of tBrush.
    TextureBrush cloneBrush = (TextureBrush)tBrush.Clone();

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

.NET Framework
Available since 1.1
Return to top