Adding the check boxes in the TREEVIEW in c#

大城市里の小女人 提交于 2021-02-07 04:54:09

问题


i want to add the check box to the child node of a certain parent node in the tree view in my application...How should i add it?


回答1:


TreeView has a property with the name CheckBoxes, if set to true, it shows checkboxes for all child nodes.




回答2:


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/




回答3:


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



来源:https://stackoverflow.com/questions/6093467/adding-the-check-boxes-in-the-treeview-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!