TextureBrush Constructors

Definition

Initializes a new TextureBrush object that uses the specified image.

Overloads

TextureBrush(Image)

Initializes a new TextureBrush object that uses the specified image.

TextureBrush(Image, WrapMode)

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

TextureBrush(Image, Rectangle)

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

TextureBrush(Image, RectangleF)

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

TextureBrush(Image, WrapMode, Rectangle)

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

TextureBrush(Image, WrapMode, RectangleF)

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

TextureBrush(Image, Rectangle, ImageAttributes)

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

TextureBrush(Image, RectangleF, ImageAttributes)

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

TextureBrush(Image)

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

Initializes a new TextureBrush object that uses the specified image.

C#
public TextureBrush(System.Drawing.Image bitmap);

Parameters

bitmap
Image

The Image object with which this TextureBrush object fills interiors.

Examples

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.

C#
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.");
    }
}

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

TextureBrush(Image, WrapMode)

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

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

C#
public TextureBrush(System.Drawing.Image image, System.Drawing.Drawing2D.WrapMode wrapMode);

Parameters

image
Image

The Image object with which this TextureBrush object fills interiors.

wrapMode
WrapMode

A WrapMode enumeration that specifies how this TextureBrush object is tiled.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

TextureBrush(Image, Rectangle)

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

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

C#
public TextureBrush(System.Drawing.Image image, System.Drawing.Rectangle dstRect);

Parameters

image
Image

The Image object with which this TextureBrush object fills interiors.

dstRect
Rectangle

A Rectangle structure that represents the bounding rectangle for this TextureBrush object.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

TextureBrush(Image, RectangleF)

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

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

C#
public TextureBrush(System.Drawing.Image image, System.Drawing.RectangleF dstRect);

Parameters

image
Image

The Image object with which this TextureBrush object fills interiors.

dstRect
RectangleF

A RectangleF structure that represents the bounding rectangle for this TextureBrush object.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

TextureBrush(Image, WrapMode, Rectangle)

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

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

C#
public TextureBrush(System.Drawing.Image image, System.Drawing.Drawing2D.WrapMode wrapMode, System.Drawing.Rectangle dstRect);

Parameters

image
Image

The Image object with which this TextureBrush object fills interiors.

wrapMode
WrapMode

A WrapMode enumeration that specifies how this TextureBrush object is tiled.

dstRect
Rectangle

A Rectangle structure that represents the bounding rectangle for this TextureBrush object.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

TextureBrush(Image, WrapMode, RectangleF)

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

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

C#
public TextureBrush(System.Drawing.Image image, System.Drawing.Drawing2D.WrapMode wrapMode, System.Drawing.RectangleF dstRect);

Parameters

image
Image

The Image object with which this TextureBrush object fills interiors.

wrapMode
WrapMode

A WrapMode enumeration that specifies how this TextureBrush object is tiled.

dstRect
RectangleF

A RectangleF structure that represents the bounding rectangle for this TextureBrush object.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

TextureBrush(Image, Rectangle, ImageAttributes)

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

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

C#
public TextureBrush(System.Drawing.Image image, System.Drawing.Rectangle dstRect, System.Drawing.Imaging.ImageAttributes? imageAttr);
C#
public TextureBrush(System.Drawing.Image image, System.Drawing.Rectangle dstRect, System.Drawing.Imaging.ImageAttributes imageAttr);

Parameters

image
Image

The Image object with which this TextureBrush object fills interiors.

dstRect
Rectangle

A Rectangle structure that represents the bounding rectangle for this TextureBrush object.

imageAttr
ImageAttributes

An ImageAttributes object that contains additional information about the image used by this TextureBrush object.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

TextureBrush(Image, RectangleF, ImageAttributes)

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

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

C#
public TextureBrush(System.Drawing.Image image, System.Drawing.RectangleF dstRect, System.Drawing.Imaging.ImageAttributes? imageAttr);
C#
public TextureBrush(System.Drawing.Image image, System.Drawing.RectangleF dstRect, System.Drawing.Imaging.ImageAttributes imageAttr);

Parameters

image
Image

The Image object with which this TextureBrush object fills interiors.

dstRect
RectangleF

A RectangleF structure that represents the bounding rectangle for this TextureBrush object.

imageAttr
ImageAttributes

An ImageAttributes object that contains additional information about the image used by this TextureBrush object.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10