-1

i'm looking for code to catch a right click in the background using a windows forms application using hooks.

I already have something for individual buttons, now I'm looking for hooks for the mouse, someone ideas?

  • Did you try anything yet? Do you have specific issue? – Olivier Dec 16 '19 at 13:54
  • Have you tried to look at this post? [How to get a right click mouse event?](https://stackoverflow.com/questions/19448346/how-to-get-a-right-click-mouse-event-changing-eventargs-to-mouseeventargs-cause) – Olivier Dec 16 '19 at 14:05
  • Does this answer your question? [How to get a right click mouse event? Changing EventArgs to MouseEventArgs causes an error in Form1Designer?](https://stackoverflow.com/questions/19448346/how-to-get-a-right-click-mouse-event-changing-eventargs-to-mouseeventargs-cause) – mrhd Dec 16 '19 at 14:12
  • thanks but yes, it illustrates all kleicks in the background, but how can I turn it off? – Patrick Kranig Dec 16 '19 at 16:06

1 Answers1

0
 Button.MouseClick += SomeMethod;
   private void SomeMethod(object sender, MouseEventArgs e)
   {
        if (!e.Button.Equals(System.Windows.Forms.MouseButtons.Right))
        {
            // do work
        }
   }
HariHaran
  • 3,642
  • 2
  • 16
  • 33