14. August 2013 21:43
SetCompatibleTextRenderingDefault (false) is an automatic method generated in the Main method of Program.cs file. Since it is automatically generated we normally don’t give any attention to this method.
static class Program
/// The main entry point for the application.
static void Main()
This article is to just to give you a brief idea about SetCompatibleTextRenderingDefault and what happens if we pass true instead of false.
In .NET Framework versions 1.0 and 1.1 applications Windows Forms controls render their text using Grpahics class which is based on GDI+ graphics. GDI+ based graphics was having some performance and localization issues.
From .NET Framework version 2.0 onwards TextRenderer class got introduced which is based on GDI graphics library to overcome the performance and localization issues of GDI+ based text rendering. Also the text looks better in GDI based rendering and has improved support for international fonts.
Calculation of character spacing, word wrapping etc. are different in GDI based rendering and GDI+ based rendering.
By default, UseCompatibleTextRendering property takes the value false. But In a Windows Forms application which uses the Graphics class to render text and having certain controls that use TextRenderer class to render text to appear different from the other text in the application, then to overcome this incompatibility issue we can set the UseCompatibleTextRendering property to true. Otherwise you don’t need to change the method call at all.