We are in the process of making our Winforms based application DPI aware(Per monitor), where the UI layer has several custom WinForms controls with custom drawing which is pixel based.
I am looking for some samples demonstrating what exactly the developers need to do for custom controls to appear scaled on High DPI monitors. Winforms is pixel based, but, as far as I understand the hard coded pixel based constants used in the custom drawing logic have to be dpi scaled. It would be good if the sample shows how to use Winforms automatic scaling framework to scale custom controls.(I would like to use AutoScaleMode.Dpi)
Some sample code which I could find online are confusing.
- The WinForms' scaling logic should be taking care of scaling the basic dimensions of controls(size, height, width etc.). Is there a need to scale those aspects for custom controls?
- Is setting control.AutoSize= true a must for control scaling to apply?
- What should we do for icons? Scale them or choose based on DPI?