Skip to content

Fix cursor editor icon width calculation for proper DPI scaling - #14575

Merged
SimonZhao888 merged 2 commits into
dotnet:mainfrom
SimonZhao888:Fix_issue_14167
Sep 1, 2026
Merged

SimonZhao888 merged 2 commits into
dotnet:mainfrom
SimonZhao888:Fix_issue_14167

Conversation

@SimonZhao888

@SimonZhao888 SimonZhao888 commented May 29, 2026 •

Copy link
Copy Markdown
Member

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

  • Modify the drawing method for list items to use the default icon width as a reference, ensuring that all icons are the same size.

Customer Impact

  • Cursor editor items are displayed correctly in propertyGrid with all DPI settings.

Regression?

  • No

Risk

  • Minimal

Screenshots

Before

image

After

150DPI:

150DPI.mp4

175DPI:

175DPI.mp4

200DPI:

200DPI.mp4

225DPI:

225DPI.mp4

Test methodology

  • Manually

Test environment(s)

  • 11.0.0-alpha.1.25619.109
Microsoft Reviewers: Open in CodeFlow
Microsoft Reviewers: Open in CodeFlow

@SimonZhao888

Copy link
Copy Markdown
Member Author

Here is another issue: when the DPI is set to 125%, 175%, 225%, 250%, the .cur icon exhibits an icon offset problem.
Normal:
image

Offset:
image

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 _cursorWidth based 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.

@SimonZhao888 SimonZhao888 added the waiting-review This item is waiting on review by one or more members of team label Jun 15, 2026
@SimonZhao888

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@KlausLoeffelmann KlausLoeffelmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@SimonZhao888
SimonZhao888 merged commit d77b565 into dotnet:main Sep 1, 2026
8 checks passed
@SimonZhao888
SimonZhao888 deleted the Fix_issue_14167 branch September 1, 2026 01:03
@dotnet-policy-service dotnet-policy-service Bot removed the waiting-review This item is waiting on review by one or more members of team label Sep 1, 2026
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 1, 2026
abineshPalanisamy pushed a commit to abineshPalanisamy/winforms that referenced this pull request Sep 3, 2026
…et#14575)

* Fix cursor editor icon width calculation for proper DPI scaling

* Handle feedback

---------

Co-authored-by: Simon Zhao (BEYONDSOFT CONSULTING INC) <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[HDPI] Cursor editor some items are not displayed in propertyGrid with special DPI settings

3 participants