TextureBrush Class
Collapse the table of content
Expand the table of content

TextureBrush Class

 

Each property of the TextureBrush class is a Brush object that uses an image to fill the interior of a shape. This class cannot be inherited.

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

System.Object
  System.MarshalByRefObject
    System.Drawing.Brush
      System.Drawing.TextureBrush

public sealed class TextureBrush : Brush

NameDescription
System_CAPS_pubmethodTextureBrush(Image)

Initializes a new TextureBrush object that uses the specified image.

System_CAPS_pubmethodTextureBrush(Image, Rectangle)

Initializes a new TextureBrush object that uses the specified image and bounding rectangle.

System_CAPS_pubmethodTextureBrush(Image, Rectangle, ImageAttributes)

Initializes a new TextureBrush object that uses the specified image, bounding rectangle, and image attributes.

System_CAPS_pubmethodTextureBrush(Image, RectangleF)

Initializes a new TextureBrush object that uses the specified image and bounding rectangle.

System_CAPS_pubmethodTextureBrush(Image, RectangleF, ImageAttributes)

Initializes a new TextureBrush object that uses the specified image, bounding rectangle, and image attributes.

System_CAPS_pubmethodTextureBrush(Image, WrapMode)

Initializes a new TextureBrush object that uses the specified image and wrap mode.

System_CAPS_pubmethodTextureBrush(Image, WrapMode, Rectangle)

Initializes a new TextureBrush object that uses the specified image, wrap mode, and bounding rectangle.

System_CAPS_pubmethodTextureBrush(Image, WrapMode, RectangleF)

Initializes a new TextureBrush object that uses the specified image, wrap mode, and bounding rectangle.

NameDescription
System_CAPS_pubpropertyImage

Gets the Image object associated with this TextureBrush object.

System_CAPS_pubpropertyTransform

Gets or sets a copy of the Matrix object that defines a local geometric transformation for the image associated with this TextureBrush object.

System_CAPS_pubpropertyWrapMode

Gets or sets a WrapMode enumeration that indicates the wrap mode for this TextureBrush object.

NameDescription
System_CAPS_pubmethodClone()

Creates an exact copy of this TextureBrush object.(Overrides Brush.Clone().)

System_CAPS_pubmethodCreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodDispose()

Releases all resources used by this Brush object.(Inherited from Brush.)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodInitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodMultiplyTransform(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.

System_CAPS_pubmethodMultiplyTransform(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.

System_CAPS_pubmethodResetTransform()

Resets the Transform property of this TextureBrush object to identity.

System_CAPS_pubmethodRotateTransform(Single)

Rotates the local geometric transformation of this TextureBrush object by the specified amount. This method prepends the rotation to the transformation.

System_CAPS_pubmethodRotateTransform(Single, MatrixOrder)

Rotates the local geometric transformation of this TextureBrush object by the specified amount in the specified order.

System_CAPS_pubmethodScaleTransform(Single, Single)

Scales the local geometric transformation of this TextureBrush object by the specified amounts. This method prepends the scaling matrix to the transformation.

System_CAPS_pubmethodScaleTransform(Single, Single, MatrixOrder)

Scales the local geometric transformation of this TextureBrush object by the specified amounts in the specified order.

System_CAPS_protmethodSetNativeBrush(IntPtr)

In a derived class, sets a reference to a GDI+ brush object. (Inherited from Brush.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodTranslateTransform(Single, Single)

Translates the local geometric transformation of this TextureBrush object by the specified dimensions. This method prepends the translation to the transformation.

System_CAPS_pubmethodTranslateTransform(Single, Single, MatrixOrder)

Translates the local geometric transformation of this TextureBrush object by the specified dimensions in the specified order.

The following code example demonstrates how to obtain a new bitmap using the FromFile method. It also demonstrates a TextureBrush.

This example is designed to be used with Windows Forms. Create a form containing a button named Button2. Paste the code into the form and associate the Button2_Click method with the button's Click event.

private void Button2_Click(System.Object sender, System.EventArgs e)
{
    try
    {
        Bitmap image1 = (Bitmap) Image.FromFile(@"C:\Documents and Settings\" +
            @"All Users\Documents\My Music\music.bmp", true);

        TextureBrush texture = new TextureBrush(image1);
        texture.WrapMode = System.Drawing.Drawing2D.WrapMode.Tile;
        Graphics formGraphics = this.CreateGraphics();
        formGraphics.FillEllipse(texture, 
            new RectangleF(90.0F, 110.0F, 100, 100));
        formGraphics.Dispose();

    }
    catch(System.IO.FileNotFoundException)
    {
        MessageBox.Show("There was an error opening the bitmap." +
            "Please check the path.");
    }

}

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft