Search code examples
c#winformslabelvisual-studio-2022windows-forms-designer

WinForms bold label displays correctly in Visual Studio Designer but gets squished when running the application


As illustrated in the screenshot below, a normal WinForms label works fine in both the Designer and the running application, but a bold label will get distorted after a certain point in the running app. I haven't changed any default properties on the labels except for setting the font style to bold for the second label. What am I doing wrong?

enter image description here


Solution

  • The solution turned out to be to add Application.SetCompatibleTextRenderingDefault(false); to Program.cs. I though that it was added by default since Visual Studio 2015, but I forgot to check and the project I was working on predates the automatic inclusion of this line by the IDE.