Pens and Brushes

As we mentioned earlier in our survey of GDI+ architecture, when you draw, you need to make use of drawing tools, such as pens and brushes, which are defined by their own classes in the .NET Framework. The Pen class defines objects that are used to draw lines and curves. A pen has a width, dash style, and a color (or in fact can have an associated brush). There are several brush classes, which are used for drawing the interior of a shape. In this section we will examine some of the details of working with pens and brushes. We begin with pens, which are simpler.


Pens are used to draw lines and curves. Compared to brushes, pens are quite simple objects. There is a single class, Pen, in the System.Drawing namespace that is ...

Get Application Development Using Visual Basic® and .NET now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.