Repository navigation
Fix UpDown buttons scaling incorrectly on DPI changes - #15207
SimonZhao888 merged 3 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The implementation leaves button layout stale, overrides supported custom heights, and lacks regression coverage.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Updates UpDownBase DPI/font handling to recalculate control and button dimensions.
Changes:
- Adds parent-font-change scaling logic.
- Records the protected override in the public API baseline.
| File | Description |
|---|---|
UpDownBase.cs |
Recalculates height and button width. |
PublicAPI.Unshipped.txt |
Adds the new override signature. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15207 +/- ##
=============================================
Coverage 37.84861% 37.84861%
=============================================
Files 246 246
Lines 9789 9789
Branches 1031 1031
=============================================
Hits 3705 3705
Misses 5920 5920
Partials 164 164
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
KlausLoeffelmann
left a comment
There was a problem hiding this comment.
Yes.
Let's please also backport this to .NET 11 - because it can screw up layout and cascade things up on for example A11Y TextSize changes.
* Fix UpDown buttons scaling incorrectly on DPI changes * Addoverride System.Windows.Forms.UpDownBase.OnParentFontChanged 同PublicAPI * Add unit test


Fixes #14784
Proposed changes
Update
UpDownBase.OnParentFontChangedto:PreferredHeight._defaultButtonsWidthbased on the current device DPI.Customer Impact
DomainUpDownandNumericUpDowncan be incorrectly sized after changing the display scaling or moving the application between monitors with different DPI settings.Regression?
Risk
Screenshots
Before
The Up/Down buttons could scale incorrectly after a DPI change. For example, the buttons could become larger when scaling down or smaller when scaling up.
Recording.2026-07-20.021407.mp4
After
The control height and default buttons width are recalculated after the parent font changes, and the Up/Down buttons scale correctly with the current DPI.
AfterChanges.mp4
Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow