The .NET Framework includes a rich set of managed classes that serve as wrappers around GDI+, the Windows XP graphics API. GDI+ improves on the original Windows Graphics Device Interface by providing new features and optimizations. The .NET Framework managed classes create an object-oriented and easy to use interface to the GDI+ graphics facilities, and completely insulate the programmer from the need to manage display contexts, handles, and other Windows graphics arcana. The programming model isn't completely different from GDI, though. If you've done Windows GDI programming you'll be right at home with the managed classes, and happy to be freed from worrying about the more mundane aspects of managing device contexts, handles, and graphics objects.
The .NET graphics API is fully contained in the System.Graphics namespace. System.Graphics contains classes that perform basic drawing functions, and namespaces that provide more specialized functionality. The table below briefly describes the contents of each of the namespaces.
|System.Drawing||Contains classes that encapsulate basic|
graphics objects including pens, brushes,
images, points, rectangles, colors, and fonts.
|System.Drawing.Design||Provides user interfaces for selecting or|
defining bitmaps, fonts, images, and other
|System.Drawing.Drawing2D||Includes classes that provide advanced|
two-dimensional and vector graphics
functionality, including gradient brushes,
geometric transformations, and graphics paths.
|System.Drawing.Imaging||Classes in this namespace provide|
advanced imaging functionality, including
metafiles and classes that allow the GDI to
be extended to work with any image file format.
|System.Drawing.Printing||Provides print-related services,|
including print preview.
|System.Drawing.Text||Provides enhanced text-handling capabilities,|
specifically in the area of fonts.
You'll find that most of your graphics work will be with classes defined in the System.Drawing and System.Drawing.Drawing2D namespaces.
Learn how to draw lines and curves in .NET at InformIT.
This was first published in April 2004