-
Notifications
You must be signed in to change notification settings - Fork 997
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
base: main
Are you sure you want to change the base?
Recalculate the node position of the TreeView when DrawMode = TreeViewDrawMode.OwnerDrawText #12698
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12698 +/- ##
===================================================
- Coverage 76.13144% 76.12229% -0.00915%
===================================================
Files 3232 3232
Lines 642100 642147 +47
Branches 47264 47272 +8
===================================================
- Hits 488840 488817 -23
- Misses 149716 149777 +61
- Partials 3544 3553 +9
Flags with carried forward coverage won't be shown. Click here to find out more. |
There was a problem hiding this 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.
src/System.Windows.Forms/src/System/Windows/Forms/Controls/TreeView/TreeView.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/TreeView/TreeView.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/TreeView/TreeView.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/TreeView/TreeView.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/TreeView/TreeView.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (3)
src/System.Windows.Forms/src/System/Windows/Forms/Controls/TreeView/TreeView.cs:2907
- [nitpick] The method name 'PreferredHeight' is not very descriptive. Consider renaming it to 'CalculatePreferredHeight'.
private int PreferredHeight
src/System.Windows.Forms/src/System/Windows/Forms/Controls/TreeView/TreeView.cs:2921
- [nitpick] The method name 'GetNodeHeight' is not very descriptive. Consider renaming it to 'CalculateNodeHeight'.
private int GetNodeHeight(TreeNode node)
src/System.Windows.Forms/src/System/Windows/Forms/Controls/TreeView/TreeView.cs:2741
- Using 'goto' is generally considered bad practice. Consider refactoring the code to eliminate the need for 'goto'.
goto default;
…wDrawMode.OwnerDrawText
13f6c73
to
3841b91
Compare
…de inversion coordinates and scroll bar status
Fixes #12681
Root Cause
When
treeView.DrawMode = TreeViewDrawMode.OwnerDrawText
, the node'sFillRectangle
andFocusRectangle
positions are calculated incorrectlyProposed changes
CustomDraw
of the TreeView.cs, WhenRightToLeft == RightToLeft.Yes && RightToLeftLayout
reverses the X drawing coordinates ofFillRectangle
andFocusRectangle
Customer Impact
Regression?
Risk
Screenshots
Before
After
When setting RightToLeft = Yes, RightToLeftLayout = True and .DrawMode = TreeViewDrawMode.OwnerDrawText, the selected node box is fully rendered
Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow