Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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#?

like image 748
Tony the Pony Avatar asked Mar 17 '09 22:03

Tony the Pony


People also ask

How do I remove the context menu in Windows 11?

In the group policy management editor (or GPEDIT. MSC), navigate to Computer Configuration\Policies\Administrative Templates. From Start Menu and Taskbar ->open Disable Context menus in the Start Menu policy setting. Select the Enabled option for disabling the context menu from Start Menu.


2 Answers

Actually:

WebBrowser browser;
browser.IsWebBrowserContextMenuEnabled = false;

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

like image 61
Paulo Santos Avatar answered Sep 17 '22 17:09

Paulo Santos


WebBrowser browser;
browser.Document.ContextMenuShowing += new HtmlElementEventHandler(MyCustomContextMenuMethod);
like image 35
Tony the Pony Avatar answered Sep 19 '22 17:09

Tony the Pony