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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With