选择树视图第二次相同的节点

选择树视图第二次相同的节点

本文介绍了选择树视图第二次相同的节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们考虑tvPlant是树视图,在其中有5个节点Tv1,Tv2,Tv3,Tv4,Tv5,现在用户选择Tv4节点,然后打开另一个窗口,在这里选择一些图片并关闭该窗口,再次选择用户相同的节点"TV4",如果用户选择TV4以外的节点,则现在不打开窗口,然后选择TV4,然后打开.我需要在用户随时选择时打开窗口


请帮助我

Let us consider tvPlant is tree view, In that have 5 nodes Tv1,Tv2,Tv3,Tv4,Tv5,Now user select the Tv4 node then it opens another window ,here choose some picture and close that window,Again user select that same node"TV4",Now its not open window if user select other than TV4, after that select TV4,Then its open.I need to open the window when user select at any time


Please help me

推荐答案

Sub Main
    Dim form1 As New Form()

    Dim treeView1 As New TreeView()
    treeView1.Nodes.Add("N1")
    treeView1.Nodes.Add("N2")
    treeView1.Nodes.Add("N3")
    treeView1.Nodes.Add("N4")
    AddHandler treeView1.NodeMouseClick, addressof treeView1_NodeClicked
    form1.Controls.Add(treeView1)

    form1.ShowDialog()
End Sub

public shared sub treeView1_NodeClicked(sender, args)
    MessageBox.Show("Node clicked")
End sub


Private Sub tvPlants_NodeMouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles tvPlants.NodeMouseClick
       tvPlants.CollapseAll()
       tvPlants.ExpandAll()
   End Sub


这篇关于选择树视图第二次相同的节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 11:37