Why winform is shown on a single 4k monitor

We have a .net windows forms application. We have already replaced most of them with a web application, but still use the Windows forms application for administrative tasks.

When this application is used on a 4k monitor, it looks very bad, and this is understandable.

But the appearance changes depending on the other monitors in the system. The test is performed on a Lenovo 430, which has a 4k monitor connected via a display port. The resolution on the laptop monitor is 1920/1080, and on 4k - 3840/2160. Display scaling is always 200%.

All of the following screen shots were taken on a 4k monitor.

  • One test with active monitor
  • One test with only a second screen
  • One test with a laptop monitor is closed (this means that only one monitor is available for the system)

enter image description hereenter image description hereenter image description here

I know that our application will not look good on 4k without changes and will set the dpiAware / dpi value.

But my question is: Why do applications look changed only depending on which monitors are active? And is there a way to control what kind of "look" is taken?

+5
source share
2 answers

You may know this, but this has not been mentioned before:

There are 3 types of applications:

  • DPI not supported
  • DPI system aware
  • On the DPI monitor

Details here: https://msdn.microsoft.com/de-de/library/windows/desktop/dn469266(v=vs.85).aspx

In app.config, you can set the DPI awareness value:

<appSettings> <add key="EnableWindowsFormsHighDpiAutoResizing" value="false" /> </appSettings> 

and app.manifest:

 <application xmlns="urn:schemas-microsoft-com:asm.v3"> <windowsSettings> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">false</dpiAware> </windowsSettings> </application> 

If you have DPI> = 150% scaling, you can additionally control it via RMB in the application → Properties → Compatibility → Scaling at a high DPI level

For Windows Forms, DPI by default is disabled for high DPI. So, everything that works, works out of the box. Maybe one of these options is not the default? Especially the configuration in RMB properties on exe?

+2
source

Microsoft is aware of this issue and fixed it using the .Net 4.7 Framework:

https://blogs.msdn.microsoft.com/dotnet/2017/04/05/announcing-the-net-framework-4-7/

+3
source

Source: https://habr.com/ru/post/1266289/


All Articles