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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.