Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recalculate the node position of the TreeView when DrawMode = TreeViewDrawMode.OwnerDrawText #12698

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

LeafShi1
Copy link
Member

@LeafShi1 LeafShi1 commented Dec 31, 2024

Fixes #12681

Root Cause

When treeView.DrawMode = TreeViewDrawMode.OwnerDrawText, the node's FillRectangle and FocusRectangle positions are calculated incorrectly

Proposed changes

  • Update function CustomDraw of the TreeView.cs, When RightToLeft == RightToLeft.Yes && RightToLeftLayout reverses the X drawing coordinates of FillRectangle and FocusRectangle

Customer Impact

  • When setting RightToLeft = Yes and RightToLeftLayout = True, the selected node box is fully rendered

Regression?

  • No

Risk

  • Minimal

Screenshots

Before

image

After

When setting RightToLeft = Yes, RightToLeftLayout = True and .DrawMode = TreeViewDrawMode.OwnerDrawText, the selected node box is fully rendered
image

Test methodology

  • Manually

Test environment(s)

  • .net 10.0.0-alpha.1.24628.1
Microsoft Reviewers: Open in CodeFlow

@LeafShi1 LeafShi1 requested a review from a team as a code owner December 31, 2024 08:05
Copy link

codecov bot commented Dec 31, 2024

Codecov Report

Attention: Patch coverage is 0% with 12 lines in your changes missing coverage. Please review.

Project coverage is 76.13939%. Comparing base (3b08ae7) to head (abe7f92).
Report is 24 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #12698         +/-   ##
===================================================
+ Coverage   76.02967%   76.13939%   +0.10972%     
===================================================
  Files           3181        3189          +8     
  Lines         639670      640126        +456     
  Branches       47215       47239         +24     
===================================================
+ Hits          486339      487388       +1049     
+ Misses        149819      149211        -608     
- Partials        3512        3527         +15     
Flag Coverage Δ
Debug 76.13939% <0.00000%> (+0.10972%) ⬆️
integration 18.17291% <0.00000%> (+0.01002%) ⬆️
production 50.03550% <0.00000%> (+0.21632%) ⬆️
test 97.02825% <ø> (+0.00078%) ⬆️
unit 47.26545% <0.00000%> (+0.21446%) ⬆️

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

@LeafShi1 LeafShi1 added the waiting-review This item is waiting on review by one or more members of team label Jan 3, 2025
@ricardobossan
Copy link
Member

I proceeded to test the PR and the issue seems to have been solved:

image

The code LGTM!

Copy link
Member

@Tanya-Solyanik Tanya-Solyanik left a comment

Choose a reason for hiding this comment

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

Had you tested this change at different scaling factors and in different level nodes in a tree view? For example 3rd level child?
It will be helpful to add code comments that describe what the constants are for.

@Tanya-Solyanik Tanya-Solyanik added 📭 waiting-author-feedback The team requires more information from the author and removed waiting-review This item is waiting on review by one or more members of team labels Jan 7, 2025
@dotnet-policy-service dotnet-policy-service bot removed the 📭 waiting-author-feedback The team requires more information from the author label Jan 7, 2025
@Tanya-Solyanik Tanya-Solyanik added 📬 waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) 📭 waiting-author-feedback The team requires more information from the author labels Jan 7, 2025
@dotnet-policy-service dotnet-policy-service bot removed the 📭 waiting-author-feedback The team requires more information from the author label Jan 8, 2025
@LeafShi1 LeafShi1 removed the 📬 waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When setting RightToLeft = Yes and RightToLeftLayout = True, the selected node box is not fully rendered
3 participants