Skip to content

Scale the Anchor editor according to DPI - #13853

Merged
LeafShi1 merged 1 commit into
dotnet:mainfrom
LeafShi1:Fix_Anchor_editor_in_propertyGrid_scale_issue
Sep 24, 2025
Merged

LeafShi1 merged 1 commit into
dotnet:mainfrom
LeafShi1:Fix_Anchor_editor_in_propertyGrid_scale_issue

Conversation

@LeafShi1

@LeafShi1 LeafShi1 commented Sep 9, 2025 •

Copy link
Copy Markdown
Member

Related #13830

Proposed changes

  • Update the InitializeComponent method to draw the Anchor Editor using the scaled size instead of hard-coding it.

Customer Impact

  • On High DPI environment, Anchor editor in propertyGrid can be scaled well

Regression?

  • No

Risk

  • Minimal

Screenshots

Before

In 300% DPI:
image

After

In 300% DPI:
image

Test methodology

  • Manually

Test environment(s)

  • .net 10.0.0-rc.1.25454.102
Microsoft Reviewers: Open in CodeFlow

@LeafShi1
LeafShi1 requested a review from a team as a code owner September 9, 2025 02:30
@LeafShi1
LeafShi1 requested review from KlausLoeffelmann and Copilot and removed request for a team September 9, 2025 02:30

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 fixes the DPI scaling issue in the AnchorEditor component by replacing hard-coded pixel values with DPI-scaled equivalents. The Anchor editor in PropertyGrid now properly scales on high DPI environments instead of appearing too small at 300% DPI.

Key changes:

  • Replace hard-coded pixel values (10, 30, 40, 60, 90) with DPI-scaled equivalents using ScaleHelper.ScaleToInitialSystemDpi()
  • Update all UI element positioning and sizing to use the scaled values

@codecov

codecov Bot commented Sep 9, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.12180%. Comparing base (6bce8b5) to head (8b7f313).
⚠️ Report is 29 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #13853         +/-   ##
===================================================
+ Coverage   77.10742%   77.12180%   +0.01437%     
===================================================
  Files           3273        3273                 
  Lines         644925      644924          -1     
  Branches       47692       47693          +1     
===================================================
+ Hits          497285      497377         +92     
+ Misses        143967      143873         -94     
- Partials        3673        3674          +1     
Flag Coverage Δ
Debug 77.12180% <100.00000%> (+0.01437%) ⬆️
integration 18.99497% <100.00000%> (+0.00426%) ⬆️
production 51.95803% <100.00000%> (+0.03030%) ⬆️
test 97.41256% <ø> (+0.00007%) ⬆️
unit 49.37407% <100.00000%> (+0.03436%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@LeafShi1
LeafShi1 force-pushed the Fix_Anchor_editor_in_propertyGrid_scale_issue branch from 69f453d to 8b7f313 Compare September 19, 2025 00:53

@ricardobossan ricardobossan 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.

All LGTM!

@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.

Looks good to me!

Do we need to bring this changes over to the OOP Designer?

@LeafShi1

Copy link
Copy Markdown
Member Author

Looks good to me!

Do we need to bring this changes over to the OOP Designer?

Yes, I have submitted a PR https://github.com/microsoft/winforms-designer/pull/6459 in OOP designer, please review it.

@LeafShi1
LeafShi1 merged commit 5a9fb88 into dotnet:main Sep 24, 2025
@LeafShi1
LeafShi1 deleted the Fix_Anchor_editor_in_propertyGrid_scale_issue branch September 24, 2025 01:01
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 24, 2025
@LeafShi1 LeafShi1 added this to the .NET 11 milestone Dec 11, 2025
@dotnet dotnet unlocked this conversation Dec 11, 2025
@Amy-Li03

Amy-Li03 commented Dec 11, 2025 •

Copy link
Copy Markdown
Contributor

Verified with .NET SDK 11.0.100-alpha.1.25609.108, issue have been fixed that Anchor editor scaled well on HDPI
image

@github-actions github-actions Bot locked and limited conversation to collaborators Jan 10, 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.

5 participants