
New HatchBrush(HatchStyle.Vertical, Color.Blue, Color.Green) The foreground color is the color of the hatching. When you fill a shape with a hatch brush, you specify a foreground color, a background color, and a hatch style. In the preceding example, the brush is of type SolidBrush, which inherits from Brush. MyGraphics.FillEllipse(mySolidBrush, 0, 0, 60, 40) MyGraphics.FillEllipse(mySolidBrush, 0, 0, 60, 40) ĭim mySolidBrush As New SolidBrush(Color.Red) SolidBrush mySolidBrush = new SolidBrush(Color.Red) The following code example shows how to fill an ellipse with a solid red color. The Brush is passed as one of the arguments to the fill method. The instance of the Graphics class provides methods, such as FillRectangle and FillEllipse, and the Brush stores attributes of the fill, such as color and pattern. To fill a closed shape, you need an instance of the Graphics class and a Brush. The following illustration shows a rectangle filled with a solid brush and an ellipse filled with a hatch brush. All of these classes inherit from the Brush class.



GDI+ provides several brush classes for filling the interiors of closed shapes: SolidBrush, HatchBrush, TextureBrush, LinearGradientBrush, and PathGradientBrush. The outline is drawn with a pen and the interior is filled with a brush. A closed shape, such as a rectangle or an ellipse, consists of an outline and an interior.
