How do I disable the context menu in the IE WebBrowser
control and instead perform custom handling of the right-click event in C#?
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.
Actually:
WebBrowser browser;
browser.IsWebBrowserContextMenuEnabled = false;
This pretty much tells the WebBrowser that the right-click context menu is not welcome.
WebBrowser browser;
browser.Document.ContextMenuShowing += new HtmlElementEventHandler(MyCustomContextMenuMethod);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With