|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
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 aobject. The following example demonstrates how to fill an ellipse with a hatch pattern:
Theconstructor 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 HatchStyle enumeration; a few of those elements are shown in the following list:
The following illustration shows the filled ellipse.
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.