MaddY
MaddY

Reputation: 25

Disabling Mouse Rightclick on WInforms

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

Answers (2)

Hans Passant
Hans Passant

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

Mayank
Mayank

Reputation: 1631

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

Upvotes: 0

Related Questions