Nóta
Aðgangur að þessari síðu krefst heimildar. Þú getur prófað aðskrá þig inn eða breyta skráasöfnum.
Aðgangur að þessari síðu krefst heimildar. Þú getur prófað að breyta skráasöfnum.
The TreeNode in the TreeView control allows users to customize the DrawMode and add checkboxes. However, the checkbox image will be truncated due to the position of the TreeNode text drawing. To avoid affecting normal, common use, you can use an AppContext switch setting to avoid checkbox truncation in these specific situations.
The checkbox image is truncated when all of the following conditions are met:
CheckBoxesis set totrueDrawModeis set toOwnerDrawTextDrawDefaultis set totruein theOnDrawNodeevent
Previous behavior
In previous versions, when the TreeView control had CheckBoxes set to true, DrawMode set to OwnerDrawText, and DrawDefault set to true in the OnDrawNode event, the TreeNode checkbox images were shown truncated on the right border.
New behavior
By setting the switch "System.Windows.Forms.TreeView.MoveTreeViewTextLocationOnePixel": true in the project's runtime config file, the TreeNode checkboxes are displayed completely when the TreeView has CheckBoxes set to true, DrawMode set to OwnerDrawText, and DrawDefault set to true in the OnDrawNode event.
Version introduced
.NET 10
Type of breaking change
This change is a behavioral change.
Reason for change
This change ensures that the checkbox of the node in the TreeView control can be fully displayed.
Recommended action
Manually add "System.Windows.Forms.TreeView.MoveTreeViewTextLocationOnePixel": true to the project's runtimeconfig.json file to enable the switch.
{
"runtimeOptions": {
"configProperties": {
"System.Windows.Forms.TreeView.MoveTreeViewTextLocationOnePixel": true
}
}
}