Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fix DPI scaling issues for Visual Studio 2017 Windows Forms

Tags:

I've been encountering this issue ever since I bought this laptop with 4k display in 2015. With a lot of effort I managed to work around the issue but I'm growing tired of it. VS2017 is supposedly DPI aware hence I do not expect any issues when creating a simple MDI Parent Form and running the app. But to my frustration the icons in the toolStrip (just the standard one in the MDI parent form) are scaled horribly. When I create a form with a button on it which looks just fine in Visual Studio 2017 designer and I run the app and load the form, the button text isn't completely shown. My display settings are as follows:

  • Resolution: 3840x2160
  • Scaled 250% (in display settings) because at 100% everything is unreadable

I've tried to find solutions, but the only workable thing I could find was setting my visual studio designer to dpi-unaware via registry (link here)

Help anyone?

Update When I add a new MDI form with the setting of DPI-awareness OFF, everything looks OK except Visual Studio itself (blurry).

like image 565
F43G4N Avatar asked Aug 09 '18 08:08

F43G4N


People also ask

How do I fix scaling in Visual Studio?

There are three options to resolve the display problem: Restart Visual Studio as a DPI-unaware process. Add a registry entry. Set your display scaling setting to 100%

How do I fix window scaling problems?

To work around scaling issues, try the following methods: Log out and in Log out and log back in to the system. This improves how applications and elements are displayed when the monitor configuration changes. Select Display > Change the size of text, apps, and other items, and then adjust the slider for each monitor.


2 Answers

I have similar problem when working with Windows Forms (Windows Forms Designer) on Visual Studio 2017, but I think it would be the same on Visual Studio 2019.

From Microsoft documentation here, there is a tip to disable the scaling/DPI aware feature.

If you prefer to manage settings from the command line, devenv.exe takes /noscale as a command-line parameter to run in 100% scaling mode.

So, basically, I just created a shortcut on the Desktop to Visual Studio (devenv.exe) and added the parameter /noscale on the shortcut Target field like so:

"...\path\to\IDE\devenv.exe" /noscale

So, everytime Visual Studio is started through the shortcut, it will always start with 100% scaling mode. If you use high resolution screen (high-dpi) screen, you will notice that the Visual Studio text will appear a little bit blurry because of this.

like image 90
Aryo Avatar answered Oct 11 '22 13:10

Aryo


You should change the settings so there won't be a difference when the program runs on different machines. Go to the project's properties page, then to Manifest Tool and then Input and Output. Change the DPI awareness to 'none' enter image description here

like image 40
Michael Haephrati Avatar answered Oct 11 '22 14:10

Michael Haephrati