WinForms controls in .NET Framework 4.7 and 4.8
- DPI unaware
- System DPI aware
- Per-Monitor DPI aware v1
- Per-Monitor DPI aware v2
- Improvements in the scaling and layout of a number of Windows Forms controls, such asthe MonthCalendar control and the CheckedListBox control.
- Single-pass scaling. In the .NET Framework 4.6 and earlier versions, scaling was performed through multiple passes, which caused some controls to be scaled more than was necessary.
- Support for dynamic DPI scenarios in which the user changes the DPI or scale factor after a Windows Forms application has been launched.
Subburaj Pandian V
Hi Manikanda,
Thank you for your benchmark code. I ran your samples as well as some that I created myself on a Surface Pro X (with an ARM Snapdragon SQ1 processor), and I only noticed minor differences in performance between .NET Framework versions. This leads me to believe that the emulation layer is actually quite optimized and the difference between using 4.8.1 vs. older versions is not very noticeable, at least with the SQ1 processor (the newer Snapdragon X processors potentially may be able to better optimize performance using 4.8.1).
However, the issue still remains that 4.6.2 does not have the high-DPI enhancements that were introduced for both WinForms and WPF. Creating a 4.8.0 build of Syncfusion would add this functionality.
WinForms Enhancements:
Starting with the .NET Framework 4.7, Windows Forms includes enhancements for common high DPI and dynamic DPI scenarios. These include:
- Improvements in the scaling and layout of a number of Windows Forms controls, such as the MonthCalendar control and the CheckedListBox control.
- Single-pass scaling. In the .NET Framework 4.6 and earlier versions, scaling was performed through multiple passes, which caused some controls to be scaled more than was necessary.
- Support for dynamic DPI scenarios in which the user changes the DPI or scale factor after a Windows Forms application has been launched.
In versions of the .NET Framework starting with the .NET Framework 4.7, enhanced high DPI support is an opt-in feature. You must configure your application to take advantage of it.
Starting with the .NET Framework 4.7, three new events allow you to programmatically handle dynamic DPI changes:
- DpiChangedAfterParent, which is fired when the DPI setting for a control is changed programmatically after a DPI change event for its parent control or form has occurred.
- DpiChangedBeforeParent, which is fired when the DPI setting for a control is changed programmatically before a DPI change event for its parent control or form has occurred.
- DpiChanged, which is fired when the DPI setting changes on the display device where the form is currently displayed.
The .NET Framework 4.7 also adds a number of new helper methods and properties that provide information about DPI scaling and allow you to perform DPI scaling. These include:
- LogicalToDeviceUnits, which converts a value from logical to device pixels.
- ScaleBitmapLogicalToDevice, which scales a bitmap image to the logical DPI for a device.
- DeviceDpi, which returns the DPI for the current device.
WPF Enhancements:
Reference: https://learn.microsoft.com/en-us/dotnet/framework/whats-new/#high-dpi-improvements-1
Windows Presentation Foundation (WPF) High DPI enhancements
In .NET Framework 4.8, WPF adds support for Per-Monitor V2 DPI Awareness and Mixed-Mode DPI scaling. See High DPI Desktop Application Development on Windows for additional information about high DPI development.
.NET Framework 4.8 improves support for hosted HWNDs and Windows Forms interoperation in High-DPI WPF applications on platforms that support Mixed-Mode DPI scaling (starting with Windows 10 April 2018 Update). When hosted HWNDs or Windows Forms controls are created as Mixed-Mode DPI-scaled windows by calling SetThreadDpiHostingBehavior and SetThreadDpiAwarenessContext, they can be hosted in a Per-Monitor V2 WPF application and are sized and scaled appropriately. Such hosted content is not rendered at the native DPI; instead, the operating system scales the hosted content to the appropriate size. The support for Per-Monitor V2 DPI awareness mode also allows WPF controls to be hosted (that is, parented) in a native window in a high-DPI application.
So as you can see from the above info, there are substantial benefits to upgrading Syncfusion Essential Studio (both WinForms and WPF) to .NET Framework 4.8.
Thanks and Kind Regards,
-Taylour
Manikanda Akash M
- 9 Replies
- 5 Participants
-
TT tttmack
- Jul 1, 2019 04:26 PM UTC
- Jul 12, 2024 12:57 PM UTC