0

The fonts on my VB.net forms application get blurry and ugly after I install it on Windows 10. I am using a Visual Studio Install project for the installation.

It looks proper (much better) when executed in Visual Studio. It happens on both VS 2022 and VS 2019, whenever the "Make everything bigger" Windows system display size is greater than 100%. This also happens on other VB.Net applications.

I am using app.manifest to enable dpiAware and dpiAwareness. This resolves the problem in Visual Studio, but not after the application installation. Is there a way to fix this?

The same code, on VS (left) and after installation (right)

xpda
  • 15,585
  • 8
  • 51
  • 82
  • 1
    Is your manifest embedded in your assembly or included in your installer? – Daniel A. White Jul 05 '23 at 19:32
  • It is embedded in the assembly, not included in the installer. – xpda Jul 05 '23 at 19:50
  • 1
    You didn't specify the .NET version you're targeting -- .NET Framework prior to 4.7.2 -> `app.manifest` - after that, `app.config`; or (in both cases) `SetProcessDpiAwareness()` / `SetProcessDpiAwarenessContext()` -- .NET 6+ -> Project configuration file, `app.manifest` still required to set the supported Systems and, in any case, to *manifest* the app, of course -- Use `PerMonitorV2` DpiAwareness – Jimi Jul 05 '23 at 21:03
  • Thanks! I'm using 4.81. Do you know where to add it in app.config? – xpda Jul 05 '23 at 21:21
  • In relation to .NET Framework, it's all in here: [High DPI support in Windows Forms](https://learn.microsoft.com/en-us/dotnet/desktop/winforms/high-dpi-support-in-windows-forms) (note that the article refers to .NET Fx 4.7 as the initial release that uses `app.config` , but it's actually .NET Fx 4.7.2 that applies it entirely) -- If you want a summary about the API calls, see the notes here: [DPI Awareness - Unaware in one Release, System Aware in the Other](https://stackoverflow.com/a/50276714/7444103) (also related to targeting PresentationFramework assemblies in WinForms) – Jimi Jul 05 '23 at 21:34
  • I appreciate the help. I moved SetProcessDpiAwareness from app.manifest to app.config and added supportedOS to app.manifest, according to [the link](https://learn.microsoft.com/en-us/dotnet/desktop/winforms/high-dpi-support-in-windows-forms?view=netframeworkdesktop-4.8) you mentioned. It works fine now. – xpda Jul 05 '23 at 22:11
  • Hi ,glad to know you've found the solution to resolve this issue! Please consider answering it and accepting it as an answer to change its status to Answered. See [can I answer my own question..](https://stackoverflow.com/help/self-answer), Just a reminder :) – Jiachen Li-MSFT Jul 13 '23 at 08:15

1 Answers1

0

This was fixed when I moved SetProcessDpiAwareness from app.manifest to app.config and added supportedOS to app.manifest, as recommended by Jimi.

Link

Note: Setting dpiAware seems to keep this from working.

xpda
  • 15,585
  • 8
  • 51
  • 82