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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. right mouse click on tree node

right mouse click on tree node

Scheduled Pinned Locked Moved C#
data-structureshelp
5 Posts 4 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.
  • S Offline
    S Offline
    shaz jazz
    wrote on last edited by
    #1

    fellows! i want a popup menu when a right click a treenode of my treeview control. i do find mousedoubleclick and mousclick event but couldn't find right mouse click.

    May God help u solv ur problems as well,thx in advance!!

    A E M 3 Replies Last reply
    0
    • S shaz jazz

      fellows! i want a popup menu when a right click a treenode of my treeview control. i do find mousedoubleclick and mousclick event but couldn't find right mouse click.

      May God help u solv ur problems as well,thx in advance!!

      A Offline
      A Offline
      aamironline
      wrote on last edited by
      #2

      You need to subsribe to MouseUp event. For Exampleprivate void treeView_MouseUp(object sender, MouseEventArgs e) { TreeViewHitTestInfo htInfo = treeView.HitTest(e.X, e.Y); MessageBox.Show(htInfo.Node.Text); }

      M Aamir Maniar aamirOnline.com

      1 Reply Last reply
      0
      • S shaz jazz

        fellows! i want a popup menu when a right click a treenode of my treeview control. i do find mousedoubleclick and mousclick event but couldn't find right mouse click.

        May God help u solv ur problems as well,thx in advance!!

        E Offline
        E Offline
        Eric Dahlvang
        wrote on last edited by
        #3

        private void treeView1_MouseClick(object sender, MouseEventArgs e)
        {
        if (e.Button == MouseButtons.Right)
        MessageBox.Show("Right mouse button clicked...do something about it");
        }

        or

        private void treeView1**_NodeMouseClick(**object sender, TreeNodeMouseClickEventArgs e)
        {
             if (e.Button == MouseButtons.Right)
                  MessageBox.Show("Right mouse button clicked on a node...do something about it");
        }

        --EricDV Sig--------- Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peters

        1 Reply Last reply
        0
        • S shaz jazz

          fellows! i want a popup menu when a right click a treenode of my treeview control. i do find mousedoubleclick and mousclick event but couldn't find right mouse click.

          May God help u solv ur problems as well,thx in advance!!

          M Offline
          M Offline
          Major_A398
          wrote on last edited by
          #4

          Here is how I have done it: private void treeView1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if(e.Button == MouseButtons.Right) { treeView1.SelectedNode = treeView1.GetNodeAt (e.X ,e.Y ); } }

          S 1 Reply Last reply
          0
          • M Major_A398

            Here is how I have done it: private void treeView1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if(e.Button == MouseButtons.Right) { treeView1.SelectedNode = treeView1.GetNodeAt (e.X ,e.Y ); } }

            S Offline
            S Offline
            shaz jazz
            wrote on last edited by
            #5

            thanks 2 all! i hav got the solution and it wil be implemented

            May God help u solv ur problems as well,thx in advance!!

            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