Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application.SetCompatibleTextRenderingDefault(false);

Tags:

c#

.net

Application.SetCompatibleTextRenderingDefault(false);

Error:

Before the establishment of the first object IWin32Window in the annex to call SetCompatibleTextRenderingDefault.

Why error? How to avoid? What does SetCompatibleTextRenderingDefault actually do?

like image 608
cnd Avatar asked Feb 26 '10 13:02

cnd


1 Answers

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.

like image 113
Unsigned Avatar answered Sep 22 '22 11:09

Unsigned