1

I have a custom draw method in a WinForms application that breaks when the user changes their screen scaling. They can do this by:

Right Click on Desktop > Click Personalise > Display > Select 125%.

How do I get access to the resolution scale so that I can recalculate the size of my controls for this increased screen scale?

Michael Edwards
  • 6,308
  • 6
  • 44
  • 75

1 Answers1

0

You might try using Control.AutoScaleFactor. I haven't tested it with other scaling factors, but if your scale is set to 100%, Control.AutoScaleFactor.Height and .Width return 1 (i.e. "100%").

rory.ap
  • 34,009
  • 10
  • 83
  • 174
  • `AutoScaleFactor` is (1, 1) regardless of DPI setting. (IE: even on a workstation that has 200% Font scaling, it is still (1, 1)). – Dave Cousineau Nov 30 '21 at 20:40