Reputation: 25
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.
Upvotes: 0
Views: 908
Reputation: 942438
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.
Upvotes: 4
Reputation: 1631
There is a way - Capturing Mouse Events from every component on C# WInForm
Upvotes: 0