Classes Used to Draw Shapes, Bitmaps, and Text

There are a number of other classes that the methods of the Graphics object use to draw shapes, bitmaps, and text to its drawing surface, and I will take some time here to briefly describe them before discussing the Graphics class itself.

The Pen Class

The Pen class is used to draw outline shapes and lines. Unlike the full .NET Framework, the .NET Compact Framework allows you to create a Pen object only by specifying the color you want the Pen to draw—you can’t create a Pen object from a Brush object or specify the size of the Pen. However, you can change the color of the Pen after you have created it by using the Color property of the Pen object. The following sample code shows how to create the

Get Microsoft® .NET Compact Framework (Core Reference) now with O’Reilly online learning.

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