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

Initializes a new TextureBrush object that uses the specified image.

public:
 TextureBrush(System::Drawing::Image ^ bitmap);
public TextureBrush (System.Drawing.Image bitmap);
new System.Drawing.TextureBrush : System.Drawing.Image -> System.Drawing.TextureBrush
Public Sub New (bitmap As Image)

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.

private:
   void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      try
      {
         Bitmap^ image1 = dynamic_cast<Bitmap^>(Image::FromFile( "C:\\Documents and Settings\\"
         "All Users\\Documents\\My Music\\music.bmp", true ));
         TextureBrush^ texture = gcnew TextureBrush( image1 );
         texture->WrapMode = System::Drawing::Drawing2D::WrapMode::Tile;
         Graphics^ formGraphics = this->CreateGraphics();
         formGraphics->FillEllipse( texture, RectangleF(90.0F,110.0F,100,100) );
         delete formGraphics;
      }
      catch ( System::IO::FileNotFoundException^ ) 
      {
         MessageBox::Show( "There was an error opening the bitmap."
         "Please check the path." );
      }
   }
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.");
    }
}
Private Sub Button2_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button2.Click
    Try
        Dim image1 As Bitmap = _
            CType(Image.FromFile("C:\Documents and Settings\" _
            & "All Users\Documents\My Music\music.bmp", True), Bitmap)

        Dim texture As New TextureBrush(image1)
        texture.WrapMode = Drawing2D.WrapMode.Tile
        Dim formGraphics As Graphics = Me.CreateGraphics()
        formGraphics.FillEllipse(texture, _
            New RectangleF(90.0F, 110.0F, 100, 100))
        formGraphics.Dispose()

    Catch ex As System.IO.FileNotFoundException
        MessageBox.Show("There was an error opening the bitmap." _
            & "Please check the path.")
    End Try

End Sub

Applies to

TextureBrush(Image, WrapMode)

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.

public:
 TextureBrush(System::Drawing::Image ^ image, System::Drawing::Drawing2D::WrapMode wrapMode);
public TextureBrush (System.Drawing.Image image, System.Drawing.Drawing2D.WrapMode wrapMode);
new System.Drawing.TextureBrush : System.Drawing.Image * System.Drawing.Drawing2D.WrapMode -> System.Drawing.TextureBrush
Public Sub New (image As Image, wrapMode As 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

TextureBrush(Image, Rectangle)

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.

public:
 TextureBrush(System::Drawing::Image ^ image, System::Drawing::Rectangle dstRect);
public TextureBrush (System.Drawing.Image image, System.Drawing.Rectangle dstRect);
new System.Drawing.TextureBrush : System.Drawing.Image * System.Drawing.Rectangle -> System.Drawing.TextureBrush
Public Sub New (image As Image, dstRect As Rectangle)

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

TextureBrush(Image, RectangleF)

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.

public:
 TextureBrush(System::Drawing::Image ^ image, System::Drawing::RectangleF dstRect);
public TextureBrush (System.Drawing.Image image, System.Drawing.RectangleF dstRect);
new System.Drawing.TextureBrush : System.Drawing.Image * System.Drawing.RectangleF -> System.Drawing.TextureBrush
Public Sub New (image As Image, dstRect As RectangleF)

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

TextureBrush(Image, WrapMode, Rectangle)

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.

public:
 TextureBrush(System::Drawing::Image ^ image, System::Drawing::Drawing2D::WrapMode wrapMode, System::Drawing::Rectangle dstRect);
public TextureBrush (System.Drawing.Image image, System.Drawing.Drawing2D.WrapMode wrapMode, System.Drawing.Rectangle dstRect);
new System.Drawing.TextureBrush : System.Drawing.Image * System.Drawing.Drawing2D.WrapMode * System.Drawing.Rectangle -> System.Drawing.TextureBrush
Public Sub New (image As Image, wrapMode As WrapMode, dstRect As Rectangle)

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

TextureBrush(Image, WrapMode, RectangleF)

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.

public:
 TextureBrush(System::Drawing::Image ^ image, System::Drawing::Drawing2D::WrapMode wrapMode, System::Drawing::RectangleF dstRect);
public TextureBrush (System.Drawing.Image image, System.Drawing.Drawing2D.WrapMode wrapMode, System.Drawing.RectangleF dstRect);
new System.Drawing.TextureBrush : System.Drawing.Image * System.Drawing.Drawing2D.WrapMode * System.Drawing.RectangleF -> System.Drawing.TextureBrush
Public Sub New (image As Image, wrapMode As WrapMode, dstRect As RectangleF)

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

TextureBrush(Image, Rectangle, ImageAttributes)

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.

public:
 TextureBrush(System::Drawing::Image ^ image, System::Drawing::Rectangle dstRect, System::Drawing::Imaging::ImageAttributes ^ imageAttr);
public TextureBrush (System.Drawing.Image image, System.Drawing.Rectangle dstRect, System.Drawing.Imaging.ImageAttributes? imageAttr);
public TextureBrush (System.Drawing.Image image, System.Drawing.Rectangle dstRect, System.Drawing.Imaging.ImageAttributes imageAttr);
new System.Drawing.TextureBrush : System.Drawing.Image * System.Drawing.Rectangle * System.Drawing.Imaging.ImageAttributes -> System.Drawing.TextureBrush
Public Sub New (image As Image, dstRect As Rectangle, imageAttr As ImageAttributes)

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

TextureBrush(Image, RectangleF, ImageAttributes)

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.

public:
 TextureBrush(System::Drawing::Image ^ image, System::Drawing::RectangleF dstRect, System::Drawing::Imaging::ImageAttributes ^ imageAttr);
public TextureBrush (System.Drawing.Image image, System.Drawing.RectangleF dstRect, System.Drawing.Imaging.ImageAttributes? imageAttr);
public TextureBrush (System.Drawing.Image image, System.Drawing.RectangleF dstRect, System.Drawing.Imaging.ImageAttributes imageAttr);
new System.Drawing.TextureBrush : System.Drawing.Image * System.Drawing.RectangleF * System.Drawing.Imaging.ImageAttributes -> System.Drawing.TextureBrush
Public Sub New (image As Image, dstRect As RectangleF, imageAttr As ImageAttributes)

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