Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Override events in TreeView

Override events in TreeView

Scheduled Pinned Locked Moved Visual Basic
csharphelp
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Knappen
    wrote on last edited by
    #1

    Helo One problem whit the TreeView in VB.NET, is that right-clicking don´t select the node. Im trying to add Context-menu´s to my Node´s. But I cant figure out a way to catch the node that was right-clicked. :confused:

    K 1 Reply Last reply
    0
    • K Knappen

      Helo One problem whit the TreeView in VB.NET, is that right-clicking don´t select the node. Im trying to add Context-menu´s to my Node´s. But I cant figure out a way to catch the node that was right-clicked. :confused:

      K Offline
      K Offline
      Knappen
      wrote on last edited by
      #2

      :cool::-DHelo If any one is intressted - I solved the problem..... What I did: A event handler tied to the MouseUp Private Sub OnTreeViewMouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles TreeViewA.MouseUp Dim pt As Point pt = New Point(e.X, e.Y) recursNodeSearch(pt, TreeViewA.Nodes) End Sub And the Sub that do the trapping: Private Sub recursNodeSearch(ByVal pt As Point, ByVal nodes As TreeNodeCollection) Dim nNode As TreeNode For Each nNode In nodes Try If nNode.Bounds.Top <= pt.Y And nNode.Bounds.Bottom >= pt.Y Then 'This check the row, is you want to check the exact location. ' If nNode.Bounds.Contains(pt) Then '=================================== TreeViewA.SelectedNode = nNode Exit Sub ElseIf nNode.IsExpanded Then recursNodeSearch(pt, nNode.Nodes) End If Catch End Try Next End Sub

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups