High DPI Support in DotNetBar for WinForms and app development recommendations
Categories: DotNetBar for Windows Forms, How To
Starting with 12.8 version of DotNetBar for WinForms we have added High DPI support to all controls in the suite. High DPI support ensures that when your applications that use our controls are scaled up on high resolution screens they retain their crisp and clean appearance and render in high resolution.
DotNetBar High DPI support relies on built-in functionality into .NET Framework for UI WinForms scaling. That means that AutoScaleMode on Forms must be set so this scaling is effective.
Recommendations for developing High DPI WinForms apps
- Mark your app as DPI aware using app.manifest file. Click here to learn how.
- Develop all User Interface on 96 DPI (no scaling) resolution on Windows
- Set AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi on the forms. We recommend using AutoScaleMode.Dpi instead of Font because Dpi auto-scale mode will result in proportional scaling.
- Optionally verify that AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F) on form is set (its done automatically). This is correct setting for AutoScaleMode.Dpi only and for UI developed on 96 DPI resolution.
- Search project wide for creation of new fonts using GraphicsUnit.World parameter and remove it. This will interfere with automatic font scaling.
- Use Symbols on DotNetBar buttons and other DotNetBar controls wherever possible since Symbols are vector based images that will scale beautifully in any resolution.
- And finally test your apps with High DPI enabled in Windows
Leave a Reply!