How do I invoke a "Right-Click" Programmtically?

  • Thread starter Thread starter the_grove_man
  • Start date Start date
You call the method that the Click event handler would call if the right
mouse button was clicked.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

It takes a tough man to make a tender chicken salad.
 
You don't. A right-click is a mousebutton event, and the MouseEventArgs
class has properties that will enable you to tell if its was a right-button
click. Your event handling code can then react to this programmatically.

What's the goal here?

Peter
 
It depends what you mean by this.
Do you want to simulate mouse clicks and movements or you just want to fire
the events of some particular control?
 
I don't want to trigger any event, I just access to a right-click. It's
a long story why I want this, but is it possible with or without win32
API?
 
Hello,

I think I haven't understood you right. But

a) If you want to invoke a system event that is a mouse right-click you
need to use the Win32 API via DLL p/Invoke.

b) If you just need to catch the event hook on the MouseClick or
MouseDown or MouseUp event and react to the member Button given by the
event:

public void OnMouseClick(object sender,
System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Right)
{
// place your code here
}
}

Bye

Matthias
 
John,

Forgive me for saying this, but it is really hard to understand your
question. That's why I asked for more info.

"...access to a right-click.." doesn't makes sense to me.

Please try to explain with more words your problem.
 
Hi Stoitcho,
I apologize for not responding more promptly. I actually solved what I
was trying to do, sorry for any ambiguity .

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top