Export (0) Print
Expand All

TextureBrush.WrapMode Property

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

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

public WrapMode WrapMode { get; set; }

Property Value

Type: System.Drawing.Drawing2D.WrapMode
A WrapMode enumeration that specifies how fills drawn by using this LinearGradientBrush object are tiled.

The following code example demonstrates how to obtain a new bitmap using the FromFile method. It also demonstrates the WrapMode property and the WrapMode enumeration.

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

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft