Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to activate “disable display scaling on high dpi settings” programatically [duplicate]

I am developing Windows form application using C# on Visual Studio 2010. I found that this application is scaled if I used high dpi display setting. But if I activate file property "disable display scaling on high dpi settings" by mouse right click menu on windows explorer, it seems that it is not scaled.

Is there a way to activate "disable display scaling on high dpi settings" programatically on Visual Studion 2010 C# or upper version ?

I tried to set application manifest file but not set it up successfully yet.

like image 965
Shoji Urashita Avatar asked Aug 18 '15 02:08

Shoji Urashita


People also ask

How do I turn off high DPI scaling?

Right-click the application, select Properties, select the Compatibility tab, and then select the Disable display scaling on high DPI settings check box.

What happens if I disable display scaling on high DPI settings?

Application: Windows will leave the application alone. This will disable DPI scaling for the application entirely, and it will appear tiny, but not blurry. This option was previously known as “Disable display scaling on high DPI settings”, and it does the same thing. System: Windows will use its normal behavior.

How do I set DPI scaling?

Alternatively, right click on an empty area on your desktop and select Display. In System, settings screen click on Displayoption from left side. Under Change the size of text, apps, and other items: 100% (Recommended), move the slider left or right to the DPI percentage you want to set for that display.

How do I fix DPI scaling issues for Visual Studio 2019?

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%


1 Answers

Using manifest file (app.manifest under Visual C# project) resolved this issue for me. For example:

<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
  <dpiAware>true</dpiAware>
</asmv3:windowsSettings>

Of course this should be inside your main "assembly" section.

P.S. I verified this when debugging GitExtensions.

P.P.S. I understand that the question is old, but may be someone still needs the info.

Update: however it may lead to automatical undesired resizing of components on the windows form.

like image 151
Do-do-new Avatar answered Nov 01 '22 02:11

Do-do-new