Fix cursor editor icon width calculation for proper DPI scaling#14575
Open
SimonZhao888 wants to merge 1 commit into
Open
Fix cursor editor icon width calculation for proper DPI scaling#14575SimonZhao888 wants to merge 1 commit into
SimonZhao888 wants to merge 1 commit into
Conversation
Member
Author
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates CursorEditor.CursorUI drawing to use a uniform cursor icon width, aiming to fix cursor editor item layout at fractional DPI settings in the PropertyGrid.
Changes:
- Adds a cached
_cursorWidthbased on the scaled default cursor icon. - Updates owner-drawn cursor list items to use that uniform width for the icon box, cursor drawing, and text offset.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+44
to
+46
| using Icon defaultIcon = Icon.FromHandle(Cursors.Default.Handle); | ||
| using Icon scaledDefaultIcon = ScaleHelper.ScaleSmallIconToDpi(defaultIcon, DeviceDpi); | ||
| _cursorWidth = scaledDefaultIcon.Size.Width; |
| @@ -70,11 +75,11 @@ protected override void OnDrawItem(DrawItemEventArgs e) | |||
| int cursorWidth = GetCursorWidthForDpi(cursor, DeviceDpi); | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fixes #14167
Root Cause
Icons similar to HSplit.cur, VSplit.cur are wider than other icons at certain DPI settings (such as 125%, 175%, 225%, 250%), which is causing the webtable to display abnormally.
Proposed changes
Customer Impact
Regression?
Risk
Screenshots
Before
After
150DPI:
150DPI.mp4
175DPI:
175DPI.mp4
200DPI:
200DPI.mp4
225DPI:
225DPI.mp4
Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow
Microsoft Reviewers: Open in CodeFlow