Fix DarkUI's floating toolbox on higher DPI monitors#1217
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to address high-DPI rendering issues affecting DarkUI floating toolboxes by changing the app’s DPI awareness mode and disabling autoscaling on the DarkFloatingToolbox control.
Changes:
- Changed TombEditor’s process DPI mode from
SystemAwaretoDpiUnaware. - Disabled WinForms autoscaling on
DarkFloatingToolboxand set a fixedAutoScaleDimensionsbaseline.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| TombEditor/Program.cs | Changes the process-wide WinForms DPI awareness mode at startup. |
| DarkUI/DarkUI/Controls/DarkFloatingToolBox.cs | Adjusts autoscaling behavior for the floating toolbox base control. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Application.EnableVisualStyles(); | ||
| Application.SetDefaultFont(new System.Drawing.Font("Segoe UI", 8.25f)); | ||
| Application.SetHighDpiMode(HighDpiMode.SystemAware); | ||
| Application.SetHighDpiMode(HighDpiMode.DpiUnaware); |
| ClampDimensions(); | ||
|
|
||
| this.AutoScaleMode = AutoScaleMode.None; | ||
| this.AutoScaleDimensions = new SizeF(96F, 96F); |
Nickelony
left a comment
There was a problem hiding this comment.
I cannot approve switching to DpiUnaware, as this is a major breaking change that is most definitely going to break everything. There needs to be another way to solve this issue, right?
|
@Nickelony I believe that on contrary, |
This pull request addresses high-DPI scaling issues by modifying how DPI awareness is handled in the application and by explicitly setting scaling properties for a custom control. These changes aim to provide more predictable UI rendering, particularly on high-DPI displays.
DPI scaling and rendering adjustments:
DpiUnawareinProgram.csto prevent automatic DPI scaling, ensuring consistent rendering across different display settings.AutoScaleModetoNoneand definedAutoScaleDimensionsin theDarkFloatingToolBoxcontrol to disable automatic scaling and specify a fixed design-time DPI, helping maintain consistent control sizing.