Application.SetCompatibleTextRenderingDefault(false);

Back in .NET 1.x, the GDI+ Graphics class was used to render certain controls. Due to performance issues, this approach was scrapped thus .NET version 2.0 and later use the GDI TextRenderer class instead.

Calling SetCompatibleTextRenderingDefault(true) forces some controls to use their old, pre-2.0 rendering.

Unless you are upgrading a .NET 1.x application, and need to keep the old style, you should always use SetCompatibleTextRenderingDefault(false). Or you can remove this call entirely; since false is the default, an explicit false call is not necessary.

Further reading can be found at the relevant MSDN page.


Update: as stated in the comments, the answer was wrong. I changed it below and referenced the MSDN article instead of rephrasing it.

As the docs state, you have to call this before creating your first window.

It sets the default rendering engine for some controls: GDI+ if true, GDI if false. See this MSDN article for all the details.

Tags:

C#

.Net