Pens and brushes determine some of the most visually obvious pieces of a graphical application — its colors.
In graphical programming terms, a pen determines the color and style of a linear feature such as a line or the edge of a circle. A brush determines how an area is filled. For example, the ellipse drawn in Figure 10-1 is filled with a red brush and outlined with a thick, dashed, purple pen.
Figure 10.1. Figure 10-1
This chapter describes pen and brush properties and tells how to set them in XAML code. It explains the different kinds of pens and brushes and the properties that determine their appearance.
A pen defines the color and geometry of a linear feature such as a line, a curve defined by a
Path control, or the edges of an ellipse or rectangle.
Interestingly, some colors that you might think would be determined by a pen are actually determined by a brush. In particular, text is rendered by filling the font's shapes with a brush rather than drawing the shapes with a pen. This is a bit counterintuitive if you think of drawing text by hand, where you usually use a pen (or a pencil or crayon, but probably not a brush unless you're practicing your Japanese calligraphy).
A pen has several different properties — all with names beginning with the word stroke — that determine its color and geometry.