I have been changing the font in a Winforms app and it caused the scaling on some forms to break. Everything looked fine in the designer but when running the app some controls were overflowing the window. Setting AutoScaleMode.Dpi on those forms fixed the issue. However, AutoScaleMode.Font is the recommended setting. Apparently Font scales the form according to the font while Dpi scales it according to Dpi. Is it fine to use AutoScaleMode.Dpi on all forms for consistency? If not, how can I fix scaling if everything looks fine in the designer?
WPF forms are DPI aware by default.


https://github.com/microsoft/WPF-Samples/blob/master/PerMonitorDPI/readme.md
You can do some hakery to make WinForms work but the settings have to be manually set all over the place.
https://stackoverflow.com/questions/4075802/creating-a-dpi-aware-application
C# devs
null reference exceptions

source

Categories: .NetCodingCsharpTech