TextRenderer.DrawText vs. Graphics.DrawString
The .Net framework introduced the GDI+ "framework" for graphics.
However, in .Net framework 2.0 Microsoft added a wrapper class to the original GDI called TextRenderer, which is claimed to be a lot faster than GDI+, specifically using the TextRenderer.DrawText method instead of Graphics.DrawString. In a first reading it may also appear articles published in MSDN magazine advocate to use it as a faster alternative.
After doing some testing I found out there is a pitfall to this approach (which is also mentioned as a side-note in the article) - if you use a device context to do your drawing (i.e. do not draw directly on the screen) it is a good idea to stick to using GDI+.
The application draws the text on a GIS map (ESRI components):
- When using transformations to change the 0,0 coordinate the DrawString method had no problem doing the translation - the DrawText method required code rewrite.
- The DrawText method was up to 3 times slower than the DrawString method.
From the research I made I also understood there are differences between the two methods in the way the drawn text actually appears on the screen, but that's another issue.