GDI+ Best Practices and Performance Techniques

It must be said that code optimization skill and knowledge of performance techniques are best acquired from the shared experiences of other developers. With the ever expanding capabilities of Internet communication, the best resources are online forums, newsgroups, and sites dedicated to code sharing. A recommended resource for topics covered in this chapter (and indeed throughout this book) is the C# Corner site (

Let's start with an introduction of the basic architecture of drawing (rendering or painting) within Windows Forms using GDI+. By the end of this chapter, you will be armed with GDI+ tips and tricks that make a significant difference in the efficiency of many performance-oriented graphics applications. Note, however, that these tips and tricks may not be applicable for Web applications.

Here are the topics that we will discuss in this chapter:

  • Understanding the drawing and rendering process
  • How to write paint event handlers for Windows Forms and controls
  • Disposing of graphics objects
  • The OnPaintBackground method
  • Drawing performance and the role of variables' scope and type
  • Double buffering
  • The SetStyle method
  • Generic tips and tricks for quality and performance

GDI+: The Next-Generation Graphics Interface

Your First GDI+ Application

The Graphics Class

Working with Brushes and Pens

Colors, Fonts, and Text

Rectangles and Regions

Working with Images

Advanced Imaging

Advanced 2D Graphics



Developing GDI+ Web Applications

GDI+ Best Practices and Performance Techniques

GDI Interoperability

Miscellaneous GDI+ Examples

Appendix A. Exception Handling in .NET

GDI+ Programming with C#
GDI+ Programming with C#
ISBN: 073561265X
Year: 2003
Pages: 145 © 2008-2020.
If you may any questions please contact us: