Skip to content

Conversation

LeafShi1
Copy link
Member

@LeafShi1 LeafShi1 commented Sep 9, 2025

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 Copilot and KlausLoeffelmann and removed request for a team September 9, 2025 02:30
Copy link
Contributor

@Copilot Copilot AI left a comment

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

Copy link

codecov bot commented Sep 9, 2025

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
Copy link
Member

@ricardobossan ricardobossan left a comment

Choose a reason for hiding this comment

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

All LGTM!

Copy link
Member

@KlausLoeffelmann KlausLoeffelmann left a comment

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
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
8 checks passed
@LeafShi1 LeafShi1 deleted the Fix_Anchor_editor_in_propertyGrid_scale_issue branch September 24, 2025 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants