This article is to just to give you a brief idea about SetCompatibleTextRenderingDefault and what happens if we pass true instead of false.
So read further on about What Is SetCompatibleTextRenderingDefault?
SetCompatibleTextRenderingDefault (false) is an automatic method generated by visual studio in the Main method of Program.cs file.
Since it is automatically generated we normally don’t give any attention to this method.
Certain controls in Windows Forms have a property called UseCompatibleTextRendering property.These Controls in Windows Forms can render their text using either the TextRenderer class or the Graphics class.
TextRenderer class is GDI graphics library based and Graphics class is based on the GDI+ graphics library.
The method SetCompatibleTextRenderingDefault is used to set the default for the UseCompatibleTextRendering property of that controls across the application.
If the parameter value of the SetCompatibleTextRenderingDefault method is true, new controls that support UseCompatibleTextRendering use the GDI+ based Graphics class for text rendering.If the parameter value is false, new controls use the GDI based TextRenderer class.
SetCompatibleTextRenderingDefault is in System.Windows.Forms namespace from assembly System.Windows.Forms.dll
static class Program
/// The main entry point for the C# application.
static void Main()
In .NET Framework version 1.0 and .NET Framework version 1.1 applications Windows Forms controls render their text using Graphics 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.
Hope this post helped you in understanding what is the relevance of UseCompatibleTextRendering property? Provide your queries and feedback about this UseCompatibleTextRendering property in the comments section below.