Add switch "MoveTreeViewTextLocationOnePixel" for update the drawing position of the Treeview node #44403
Open
1 of 3 tasks
Labels
breaking-change
Indicates a .NET Core breaking change
doc-idea
Indicates issues that are suggestions for new topics [org][type][category]
Pri1
High priority, do before Pri2 and Pri3
⌚ Not Triaged
Not triaged
Description
The TreeNode in the TreeView control allows users to customize DrawMode and add checkboxes. However, under certain conditions (CheckBoxes=true,DrawMode=OwnerDrawText, In OnDrawNode event set DrawDefault=true), the checkbox image will be truncated due to the position of the TreeNode text drawing. To avoid affecting normal common use, an AppContext switch setting is added here to solve the problem of checkbox truncation in certain situations.
Version
.NET 10 Preview 1
Previous behavior
TreeView control with CheckBoxes=true, DrawMode=OwnerDrawText, and set DrawDefault=true in OnDrawNode event
the TreeNode CheckBox images are shown truncated on the right border.
New behavior
Set switch
"System.Windows.Forms.TreeView.MoveTreeViewTextLocationOnePixel": true
in project's runtime config file and then when TreeView with CheckBoxes=true, DrawMode=OwnerDrawText, and set DrawDefault=true in OnDrawNode event, the TreeNode'checkboxes can be shown completedType of breaking change
Reason for change
This change ensures that the checkbox of the node in the TreeView control can be fully displayed.
Recommended action
Users need to manually add
"System.Windows.Forms.TreeView.MoveTreeViewTextLocationOnePixel": true
to their project's runtimeconfig.json file to turn on the switch.Feature area
Windows Forms
Affected APIs
https://learn.microsoft.com/dotnet/api/system.windows.forms.treeview.checkboxes
The text was updated successfully, but these errors were encountered: