Tony the Pony
Tony the Pony

Reputation: 41447

Disable context menu in Internet Explorer control

How do I disable the context menu in the IE WebBrowser control and instead perform custom handling of the right-click event in C#?

Upvotes: 7

Views: 7028

Answers (3)

Tony the Pony
Tony the Pony

Reputation: 41447

WebBrowser browser;
browser.Document.ContextMenuShowing += new HtmlElementEventHandler(MyCustomContextMenuMethod);

Upvotes: 5

Paulo Santos
Paulo Santos

Reputation: 11587

Actually:

WebBrowser browser;
browser.IsWebBrowserContextMenuEnabled = false;

This pretty much tells the WebBrowser that the right-click context menu is not welcome.

Upvotes: 9

SchizoDuckie
SchizoDuckie

Reputation: 9401

AddHandler Me.WebBrowser1.Document.ContextMenuShowing, AddressOf WebContextMenuShowing

I litterally copied your question and worked my google-fu on it...

This was on the first result page :-P

Upvotes: 2

Related Questions