添加兄弟节点,添加子节点,节点重命名,删除节点。
谢谢!

解决方案 »

  1.   

    学过xml吧  先写一个xml文档放在一个数据库中,  向页面上拖一个 treeview 显示工具  然后给他配置数据时选中刚才写的xml 文档,应该就能把它显示成树状形式。
      

  2.   


    '添加节点
     Sub CreateTree(ByVal NodeText As String)    ' Create the root node using the default constructor.
        Dim root As TreeNode = New TreeNode
        root.Text = NodeText    ' Use the ChildNodes property of the root TreeNode to add child nodes.
        ' Create the node using the constructor that takes the text parameter.
        root.ChildNodes.Add(New TreeNode("Topic 1"))    ' Create the node using the constructor that takes the text and value parameters.
        root.ChildNodes.Add(New TreeNode("Topic 2", "Value 2"))    ' Create the node using the constructor that takes the text, value, 
        ' and imageUrl parameters.
        root.ChildNodes.Add(New TreeNode("Topic 3", "Value 3", "Image1.jpg"))    ' Create the node using the constructor that takes the text, value, 
        ' imageUrl, navigateUrl, and target parameters.
        root.ChildNodes.Add(New TreeNode("Topic 4", "Value 4", "Image1.jpg", "http://www.microsoft.com", "_blank"))    ' Add the root node to the Nodes collection of the TreeView control.
        DynamicTreeView.Nodes.Add(root)  End Sub
    '删除节点
    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()      ' Remove 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