0

I have been looking into High DPI support for Windows Forms, as per the following link.

https://learn.microsoft.com/en-us/dotnet/desktop/winforms/high-dpi-support-in-windows-forms

However, I'm not sure exactly what the High DPI support actually accomplishes, does the High DPI support simply mean that controls and fonts will be rendered smoothly on High DPI displays?

I have tried enabling High DPI via an Application Manifest File in my Windows Forms project, but this didn't seem to have any visible effect on the application. Everything still appears to be the same size within the application.

--

I've also been looking at the following link regarding automatic form scaling.

https://learn.microsoft.com/en-us/dotnet/desktop/winforms/forms/autoscale

However, again I'm not sure what this is saying, will the auto-scaling actually make controls and fonts look bigger on a high DPI display?

--

Now for my actual problem.

I am designing a form which is 405x720 pixels in size on a 24 inch 1920x1080 display @ 96 DPI. I want the controls and fonts on the form to have the same physical dimensions when displayed fullscreen on a 6 inch 720x1280 screen which is around 244 DPI.

There is a potential solution for this at the following link.

Scale windows forms window

Is an approach similar to the one in the above StackOverflow link above still the only way to achieve what I am looking for regardless of the High DPI improvements in the latest versions of .NET, or am I potentially missing something with the High DPI and automatic scaling?

Jack
  • 33
  • 1
  • 8
  • You didn't mention what Framework version your app is targeting. Start applying this: [How to configure an app to run correctly on a machine with a high DPI setting](https://stackoverflow.com/a/13228495/7444103). As you may have read in *High DPI support in Windows Forms*, the use of `app.config` is preferred. So you may want to *upgrade*. But it depends on the Framework version. 4.7.1+ in Windows 10, not that relevant in Windows 7 (if it's a concern). After that, the System won't scale (virtualize) your Forms. Set `AutoScaleMode` to `Dpi`. Some Controls need that you set the Font explicitly. – Jimi Dec 01 '20 at 12:49
  • Thanks for the comment. Currently on .NET Framework 4.6.1 but can move to 4.7.2 if required. As far as I can tell from the response to the other StackOverflow question you linked to, enabling High DPI will fix any issues with 'fuzziness', but I'd still need to implement by own custom scaling logic if I want controls and fonts to appear bigger on smaller screens with high DPIs? – Jack Dec 01 '20 at 14:45
  • *I want the controls and fonts on the form to have the same physical dimensions*: do you want to scale based on the Font and/or the screen proportions or do you want to keep the *same physical dimensions*? – Jimi Dec 01 '20 at 16:05
  • If a button measures 5cm by 2cm on my development monitor, I would like the button to be the same size on any display, regardless of the size of the display or its DPI. Additionally, if the font was 0.5 cm in height within the button I would also want it to be the same size on any display. – Jack Dec 02 '20 at 09:29

0 Answers0