4

I have been having issues getting the font on my exported C# project to be as crisp as the font in the designer. It looks perfect when I'm designing it, but when I run the program or export it, the font is blurry.

Example Screenshot #1

Example Screenshot #2

maccettura
  • 10,514
  • 3
  • 28
  • 35

1 Answers1

6

I think you need to declare your application as supporting high DPI screens. Details can be found here: https://learn.microsoft.com/en-us/dotnet/framework/winforms/high-dpi-support-in-windows-forms

Your application needs to target .NET 4.7. You need to add a compatibility declaration for Windows 10 in your manifest file:

<compatibility xmlns="urn:schemas-microsoft.com:compatibility.v1">
  <application>
    <!-- Windows 10 compatibility -->
    <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
  </application>
</compatibility>

Also, enable per-monitor DPI awareness in your app.config:

<System.Windows.Forms.ApplicationConfigurationSection>
  <add key="DpiAwareness" value="PerMonitorV2" />
</System.Windows.Forms.ApplicationConfigurationSection>    
Erik
  • 5,355
  • 25
  • 39
  • Adding the DPI Awareness section to my App.config solved it! Thank you! But seriously, Microsoft, why is this not something that is Enabled by Default! – Morné Mar 02 '22 at 08:02