简体   繁体   中英

Adding the check boxes in the TREEVIEW in c#

我想在我的应用程序的树视图中将复选框添加到某个父节点的子节点...我该如何添加它?

TreeView有一个名为CheckBoxes的属性,如果设置为true ,它会显示所有子节点的复选框。

The TreeView API only allows you to add/remove checkboxes for EVERY node. If that's what you want, then the answer is easy - use the TreeView's CheckBoxes property.

If you want a checkbox for a particular node in the tree only, then it gets tricky. .NET doesn't directly support that. You can get the tree to accept it using Win32 message overrides, see the link below for a solution elsewhere:

http://dotnetfollower.com/wordpress/2011/05/winforms-treeview-hide-checkbox-of-treenode/

You can't show checkboxes only for some TreeNode s - only for all of them or none at all. To enable the checkboxes for your tree set the CheckBoxes property to true .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM