After Graphics, Pen and Brush are the two most important graphics classes. Whenever you perform any drawing operation that does not manipulate an image's pixels directly, you use a Pen or a Brush.
Pen classes control the appearance of lines. They determine a line's color, thickness, dash style, and caps.
Brush classes control the appearance of filled areas. They can fill an area with solid colors, hatched colors, a tiled image, or different kinds of color gradients.
This chapter describes the Pen and Brush classes in detail. It shows how to use these classes to draw and fill all sorts of interesting shapes.
This chapter also describes the GraphicsPath class that represents a series of lines, shapes, curves, and text. You can fill a GraphicsPath using Pen and Brush classes.
The Pen object determines how lines are drawn. It determines the lines' color, thickness, dash style, join style, and end cap style.
A program can explicitly create Pen objects, but often it can simply use one of the more than 280 pens that are predefined by the Pens class. For example, the following code draws a rectangle using a hot pink line that's one pixel wide:
gr.DrawRectangle(Pens.HotPink, 10, 10, 50, 50)
Pen objects are scaled by transformations applied to a Graphics object, ...