|
|
|
|
|
Dicas
|
|
Visual Basic.Net (ActiveX/Controles/DLL)
|
|
|
Título da Dica: Selecionando um nó de um objeto Treeview com evento MouseMove
|
|
|
|
Postada em 9/10/2003 por ~Ð@®£@Ñ
Neste exemplo demonstramos como identificar um nó existente num objeto Treeview utilizando o evento MouseMove.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.TreeView1.Nodes.Add("C:\") For Each str As String In Directory.GetDirectories("C:\") Me.TreeView1.Nodes(0).Nodes.Add(str.Substring(3)) Next End Sub Private Sub TreeView1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseMove Dim n As TreeNode = TreeView1.GetNodeAt(e.X, e.Y) If (Not n Is Nothing) Then For Each node As TreeNode In Me.TreeView1.Nodes(0).Nodes If (node Is n) Then Me.TreeView1.SelectedNode = node End If Next End If End Sub
|
|
|
|
|