.NET version
.NET 10.0
Did it work in .NET Framework?
Yes
Did it work in any of the earlier releases of .NET Core or .NET 5+?
Works in .NET Core 3.0 - .NET 9.0
Issue description
Background: I have a DPI aware project that targets a very wide range of platforms starting with .NET Framework 3.5. Per-monitor DPI awareness is not a trivial task, especially if almost every .NET version changes something that breaks the previous behavior, and I have to provide an unified appearance, no matter what the target is. So far, I managed to harmonize the behavior of the ToolStrip control for the various .NET versions, but .NET 10 introduced a change that I could not work around so far.
Issue Details:
Use the attached project that supports multiple targets. To follow the cases easier, it displays the .NET version and the current DPI. Set the DPI of the primary screen to a higer value (e.g. 150%). If you start the app in any .NET version, you should see something like this:
Starting the app with 150% scaling (144 DPI)
Now change the DPI to 100% (or drag the form to a non-primary display with 100% DPI). On .NET Framework 4.7+ and .NET Core 3.0 - .NET 9.0 you the form rescales itself as follows:
Changing the scaling to 100% (96 DPI) on .NET versions that handle DPI changes correctly
Older framework versions don't handle DPI change automatically, but you can work it around by ticking the check box (now let's ignore that the checkbox visual is not resized, I have a workaround for that, too):
Manual scaling on older frameworks
But on .NET 10.0, something is broken. Whereas other controls are scaled correctly, the auto scaling of ToolStrip does not work like in .NET 9.0:
.NET 10.0: Auto scaling of the ToolStrip does not work correctly
And even if I go for manual scaling, the primary menu items under the drop-down menus have too large height (even though the font is scaled correctly), whereas the submenu items have correct height:
.NET 10: Unlike on old frameworks, manual scaling does not fix the appearance - see the huge menu item heights
The menu item height issue is that I have no workaround for. Or is there a way to opt out of any automatic DPI scaling so I can do everything manually? For the .NET Framework there is the EnableWindowsFormsHighDpiAutoResizing option (among others) in the app.config file, but is there something similar for .NET? To be honest, the small changes in DPI handling from version to version cause much headache in such a multi-target project.
Steps to reproduce
Add a ToolStrip to a Form with drop-down/split buttons and some menu items.
See the attached HighDpiToolstripIssue.zip for a minimal repro project.
- Before starting the application, change set a high DPI for the primary display (e.g. 150% as in the screenshots above). If you have multiple monitors, set the DPI of the secondary display to 100%.
- Select
net10.0-windows as the platform target and start the application
- Change the DPI to 100% (or drag the form to the secondary display with 100% DPI). Now you can observe the too big font of the
ToolStrip (which is not the case with earlier versions)
- Tick the Scale Font Manually checkbox. Now the font size is correct, but if you drop down the menus, you can see that the height of the menu items is still too big.
.NET version
.NET 10.0
Did it work in .NET Framework?
Yes
Did it work in any of the earlier releases of .NET Core or .NET 5+?
Works in .NET Core 3.0 - .NET 9.0
Issue description
Background: I have a DPI aware project that targets a very wide range of platforms starting with .NET Framework 3.5. Per-monitor DPI awareness is not a trivial task, especially if almost every .NET version changes something that breaks the previous behavior, and I have to provide an unified appearance, no matter what the target is. So far, I managed to harmonize the behavior of the
ToolStripcontrol for the various .NET versions, but .NET 10 introduced a change that I could not work around so far.Issue Details:
Use the attached project that supports multiple targets. To follow the cases easier, it displays the .NET version and the current DPI. Set the DPI of the primary screen to a higer value (e.g. 150%). If you start the app in any .NET version, you should see something like this:
Starting the app with 150% scaling (144 DPI)
Now change the DPI to 100% (or drag the form to a non-primary display with 100% DPI). On .NET Framework 4.7+ and .NET Core 3.0 - .NET 9.0 you the form rescales itself as follows:
Changing the scaling to 100% (96 DPI) on .NET versions that handle DPI changes correctly
Older framework versions don't handle DPI change automatically, but you can work it around by ticking the check box (now let's ignore that the checkbox visual is not resized, I have a workaround for that, too):
Manual scaling on older frameworks
But on .NET 10.0, something is broken. Whereas other controls are scaled correctly, the auto scaling of
ToolStripdoes not work like in .NET 9.0:.NET 10.0: Auto scaling of the ToolStrip does not work correctly
And even if I go for manual scaling, the primary menu items under the drop-down menus have too large height (even though the font is scaled correctly), whereas the submenu items have correct height:
.NET 10: Unlike on old frameworks, manual scaling does not fix the appearance - see the huge menu item heights
The menu item height issue is that I have no workaround for. Or is there a way to opt out of any automatic DPI scaling so I can do everything manually? For the .NET Framework there is the
EnableWindowsFormsHighDpiAutoResizingoption (among others) in theapp.configfile, but is there something similar for .NET? To be honest, the small changes in DPI handling from version to version cause much headache in such a multi-target project.Steps to reproduce
Add a
ToolStripto aFormwith drop-down/split buttons and some menu items.See the attached HighDpiToolstripIssue.zip for a minimal repro project.
net10.0-windowsas the platform target and start the applicationToolStrip(which is not the case with earlier versions)