ImageAttributes.SetWrapMode Method (WrapMode)


Sets the wrap mode that is used to decide how to tile a texture across a shape, or at shape boundaries. A texture is tiled across a shape to fill it in when the texture is smaller than the shape it is filling.

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

member SetWrapMode : 
        mode:WrapMode -> unit


Type: System.Drawing.Drawing2D.WrapMode

An element of WrapMode that specifies how repeated copies of an image are used to tile an area.

Calling the SetWrapMode(WrapMode) method is equivalent to calling SetWrapMode(WrapMode, Color) and passing Color.Black for the color parameter. Color.Black specifies the color of pixels outside of a rendered image. This color is visible if the mode parameter is set to Clamp and the source rectangle passed to the DrawImage method is larger than the image itself.

The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. The code performs the following actions:

  1. Opens an Image from the Circle3.jpg file (a small, red-filled circle) and draws it to the screen.

  2. Creates an ImageAttributes object and sets the WrapMode enumeration to Tile.

  3. Creates a TextureBrush using the image from the Circle3.jpg file.

  4. Draws a rectangle to the screen that is filled with the small, red-filled circles.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top