0

I have Windows Forms application and I need to disable MouseRightclick on my Application except on some controls..is there any generalize method to do so...or i have to disable it on each controls? thanks.

MaddY
  • 25
  • 3

2 Answers2

4

A right-click doesn't do anything until you give it a meaning. Like setting a control's ContextMenuStrip property or writing an event handler for the MouseDown event. A few controls do have predefined behavior, TextBox for example has its own baked-in context menu. You don't want to disable it.

So disable it by simply not doing anything to make it work. IMessageFilter is indeed the only other hack.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
0

There is a way - Capturing Mouse Events from every component on C# WInForm

Community
  • 1
  • 1
Mayank
  • 1,621
  • 2
  • 14
  • 30