如何在vb.net中删除treeview节点 [英] How to delete treeview node in vb.net
本文介绍了如何在vb.net中删除treeview节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在vb.net中删除treeview节点
我有listview如果我选择任何项目我要删除来自treeview?
解决方案
TreeNode.Remove [ ^ ]将完成这项工作;)
如需了解更多信息,请参阅:
如何:遍历Windows窗体TreeView控件的所有节点 [ ^ ]
如何:使用Windows窗体TreeView控件添加和删除节点 [ ^ ]
以下是vb中的示例
私有 Sub treeView1_MouseDown(sender As Object ,_
e As MouseEventArgs)句柄 treeView1.MouseDown
选择 案例 e.Button
' 删除TreeNode在鼠标光标下
' 如果单击鼠标右键。
案例 MouseButtons.Right
treeView1.GetNodeAt(eX,eY).Remove()
' 在鼠标光标下切换TreeNode
' 如果单击鼠标中键(鼠标滚轮)。
Case MouseButtons.Middle
treeView1.GetNodeAt(eX,eY).Toggle()
结束 选择
结束 子跨度>
How to delete treeview node in vb.net
I have listview if i select any item that item i want to remove from treeview?
解决方案
TreeNode.Remove[^] will do the job ;)
For further information, please see:
How to: Iterate Through All Nodes of a Windows Forms TreeView Control[^]
How to: Add and Remove Nodes with the Windows Forms TreeView Control[^]
Here is the examples in vb
Private Sub treeView1_MouseDown(sender As Object, _ e As MouseEventArgs) Handles treeView1.MouseDown Select Case e.Button ' Remove the TreeNode under the mouse cursor ' if the right mouse button was clicked. Case MouseButtons.Right treeView1.GetNodeAt(e.X, e.Y).Remove() ' Toggle the TreeNode under the mouse cursor ' if the middle mouse button (mouse wheel) was clicked. Case MouseButtons.Middle treeView1.GetNodeAt(e.X, e.Y).Toggle() End Select End Sub
这篇关于如何在vb.net中删除treeview节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文