Expand
HatchBrush Class

Defines a rectangular brush with a hatch style, a foreground color, and a background color. This class cannot be inherited.

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

'Declaration

Public NotInheritable Class HatchBrush _
	Inherits Brush
Remarks

A hatch pattern is made from two colors: one defined by the BackgroundColor, which fills the background and one for the lines that form the pattern over the background defined by the ForegroundColor property. The HatchStyle property defines what type of pattern the brush has and can be any value from the HatchStyle enumeration. There are more than fifty elements in the HatchStyle enumeration.

The following illustration shows an ellipse filled with a horizontal hatch pattern.

Hatch Pattern
Examples

The following example shows how to create the HatchBrush shown in the previous illustration.


        Dim hBrush As New HatchBrush( _
           HatchStyle.Horizontal, _
           Color.Red, _
           Color.FromArgb(255, 128, 255, 255))
        e.Graphics.FillEllipse(hBrush, 0, 0, 100, 60)



Inheritance Hierarchy

System.Object
  System.MarshalByRefObject
    System.Drawing.Brush
      System.Drawing.Drawing2D.HatchBrush
Thread Safety

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

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Community ContentAdd
Page view tracker