--- title: "How to: Fill a Shape with a Hatch Pattern" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "patterns [Windows Forms], adding to shapes" - "shapes [Windows Forms], filling with patterns" - "brushes [Windows Forms], using hatch brushes" ms.assetid: 9c8300ff-187b-404f-af1f-ebd499f5b16f --- # How to: Fill a Shape with a Hatch Pattern A hatch pattern is made from two colors: one for the background and one for the lines that form the pattern over the background. To fill a closed shape with a hatch pattern, use a object. The following example demonstrates how to fill an ellipse with a hatch pattern: ## Example The constructor takes three arguments: the hatch style, the color of the hatch line, and the color of the background. The hatch style argument can be any value from the enumeration. There are more than fifty elements in the enumeration; a few of those elements are shown in the following list: - - - - - - The following illustration shows the filled ellipse. ![Screenshot of what an ellipse filled with a hatch pattern looks like.](./media/how-to-fill-a-shape-with-a-hatch-pattern/ellipse-filled-hatch.png "hatch1") [!code-csharp[System.Drawing.UsingABrush#41](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Drawing.UsingABrush/CS/Class1.cs#41)] [!code-vb[System.Drawing.UsingABrush#41](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Drawing.UsingABrush/VB/Class1.vb#41)] ## Compiling the Code The preceding example is designed for use with Windows Forms, and it requires `e`, which is a parameter of the event handler. ## See also - [Using a Brush to Fill Shapes](using-a-brush-to-fill-shapes.md)