* Merge winforms framework content to working branch (#14) * Breadcrumb / TOC / Move net5 to net folder (#15) * change path from net5 to net * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Add .net 5 winforms placeholder article (#16) * added some metadata and adjusted net5 placeholder * corrections * corrections * corrections * Test1 * Swapping landing page vs concept * fix links * Fix links * Fix desc
2.3 KiB
title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | dev_langs | helpviewer_keywords | ms.assetid | |||||
|---|---|---|---|---|---|---|---|---|---|
| How to: Fill a Shape with a Hatch Pattern | 03/30/2017 |
|
|
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 xref:System.Drawing.Drawing2D.HatchBrush object. The following example demonstrates how to fill an ellipse with a hatch pattern:
Example
The xref:System.Drawing.Drawing2D.HatchBrush.%23ctor%2A 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 xref:System.Drawing.Drawing2D.HatchStyle enumeration. There are more than fifty elements in the xref:System.Drawing.Drawing2D.HatchStyle enumeration; a few of those elements are shown in the following list:
The following illustration shows the filled ellipse.
[!code-csharpSystem.Drawing.UsingABrush#41] [!code-vbSystem.Drawing.UsingABrush#41]
Compiling the Code
The preceding example is designed for use with Windows Forms, and it requires xref:System.Windows.Forms.PaintEventArgse, which is a parameter of the xref:System.Windows.Forms.Control.Paint event handler.
