Skip to content

Conversation

@LeafShi1
Copy link
Member

@LeafShi1 LeafShi1 commented Jan 30, 2026

Fixes #13194

Root Cause

TreeView does not scale its ImageList icons when the DPI changes. The native TreeView control receives the original ImageList with unscaled images, causing icons to appear small relative to scaled text and other UI elements at high DPI.

Proposed changes

  • Override RescaleConstantsForDpi in TreeView to handle DPI changes
  • Create an internal scaled copy of the user's ImageList when DPI requires scaling
  • Update OnHandleCreated to use scaled ImageList when running at high DPI
  • Clear scaled ImageList when the user changes the ImageList or when it's recreated
  • Properly dispose of scaled ImageList resources

Customer Impact

  • Affects users displaying TreeView with ImageList on high DPI displays.

Regression?

  • No

Risk

  • Minimal

Screenshots

Before

The tree view icons are the same size at 200% and 100% DPI

After

The image will be scaled according to the different DPI settings.

AfterChanges.mp4

Test methodology

  • Manually

Test environment(s)

  • .net 11.0.0-preview.1.26078.110
Microsoft Reviewers: Open in CodeFlow

Copy link
Contributor

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

❌ Patch coverage is 18.64407% with 48 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.17468%. Comparing base (768186a) to head (564157a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #14255         +/-   ##
===================================================
- Coverage   77.18286%   77.17468%   -0.00819%     
===================================================
  Files           3279        3279                 
  Lines         645129      645187         +58     
  Branches       47728       47739         +11     
===================================================
- Hits          497929      497921          -8     
- Misses        143511      143569         +58     
- Partials        3689        3697          +8     
Flag Coverage Δ
Debug 77.17468% <18.64407%> (-0.00819%) ⬇️
integration 18.97973% <1.69492%> (-0.01290%) ⬇️
production 52.04668% <18.64407%> (-0.01327%) ⬇️
test 97.40479% <ø> (ø)
unit 49.50740% <18.64407%> (-0.01173%) ⬇️

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.

@SimonZhao888
Copy link
Member

All LGTM!

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.

TreeView icons are not scaled on high DPI

3 participants