---
title: "HatchBrush Class"
canonical: https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_HatchBrush.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# HatchBrush Class
 
This class represents a brush which fills the shape with predefined pattern.
 
**Namespace:** [Aurigma.GraphicsMill.Drawing](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Drawing.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```
Public NotInheritable Class HatchBrush _Inherits Brush
```
 
```csharp
public sealed class HatchBrush : Brush
```
 
## Remarks
  
Hatch brush is defined with three parameters: hatch style or pattern ([HatchStyle](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_HatchBrush_HatchStyle.htm.md) property), foreground color, i.e. color of the pattern ([ForegroundColor](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_HatchBrush_ForegroundColor.htm.md) property), and background color ([BackgroundColor](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_HatchBrush_BackgroundColor.htm.md) property). Besides of this, you can disable background with [TransparentBackground](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_HatchBrush_TransparentBackground.htm.md) property. In this case only pattern will be drawing with foreground on the underlying image.
 
You can convert this brush instance into its analogue from [System.Drawing](http://msdn2.microsoft.com/en-us/xs6ftd89) namespace using method [ToGdiplusBrush()](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Drawing_HatchBrush_ToGdiplusBrush.htm.md), or appropriate [cast operator](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Drawing_HatchBrush_op_Implicit_1_932e6cb5.htm.md).
 
## Examples
  
```
Dim bitmap As New Aurigma.GraphicsMill.Bitmap( _
 Aurigma.GraphicsMill.RgbColor.White, 185, 145, _
 Aurigma.GraphicsMill.PixelFormat.Format24bppRgb)

Dim graphics As Aurigma.GraphicsMill.Drawing.GdiGraphics = bitmap.GetGdiGraphics()

'Draw filled but non-outlined ellipse
Dim brush As New Aurigma.GraphicsMill.Drawing.HatchBrush
brush.ForegroundColor = Aurigma.GraphicsMill.RgbColor.Blue
brush.BackgroundColor = Aurigma.GraphicsMill.RgbColor.Yellow
brush.TransparentBackground = True
brush.HatchStyle = Aurigma.GraphicsMill.Drawing.HatchStyle.Cross

graphics.FillEllipse(brush, 60, 40, 100, 80)
```
 
```csharp
Aurigma.GraphicsMill.Bitmap bitmap  = new Aurigma.GraphicsMill.Bitmap( 
    Aurigma.GraphicsMill.RgbColor.White, 185, 145, 
    Aurigma.GraphicsMill.PixelFormat.Format24bppRgb);

Aurigma.GraphicsMill.Drawing.GdiGraphics graphics = bitmap.GetGdiGraphics();

//Draw filled but non-outlined ellipse
Aurigma.GraphicsMill.Drawing.HatchBrush brush = 
    new Aurigma.GraphicsMill.Drawing.HatchBrush();
brush.ForegroundColor = Aurigma.GraphicsMill.RgbColor.Blue;
brush.BackgroundColor = Aurigma.GraphicsMill.RgbColor.Yellow;
brush.TransparentBackground = true;
brush.HatchStyle = Aurigma.GraphicsMill.Drawing.HatchStyle.Cross;

graphics.FillEllipse(brush, 60, 40, 100, 80);
```
 
## Inheritance Hierarchy
  
- [System.Object](http://msdn2.microsoft.com/en-us/e5kfa45b)
    - [Aurigma.GraphicsMill.Drawing.Brush](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_Brush.htm.md)
        - Aurigma.GraphicsMill.Drawing.HatchBrush
 
## Thread Safety
 Static members of this type are safe for multi-threaded operations. Instance members of this type are not safe for multi-threaded operations.
 
## Object Model

[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_301.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_HatchBrush.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel1.png)![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_298.png)
  
## See Also

### Reference

- [HatchBrush Members](https://www.graphicsmill.com/docs/gm5/AllMembers_T_Aurigma_GraphicsMill_Drawing_HatchBrush.htm.md)
- [Aurigma.GraphicsMill.Drawing Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Drawing.htm.md)
