简体   繁体   English

禁用 Internet Explorer 控件中的上下文菜单

[英]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#?如何禁用 IE WebBrowser控件中的上下文菜单,而是执行 C# 中的右键单击事件的自定义处理?

Actually:实际上:

WebBrowser browser;
browser.IsWebBrowserContextMenuEnabled = false;

This pretty much tells the WebBrowser that the right-click context menu is not welcome.这几乎告诉 WebBrowser 不欢迎右键单击上下文菜单。

WebBrowser browser;
browser.Document.ContextMenuShowing += new HtmlElementEventHandler(MyCustomContextMenuMethod);
AddHandler Me.WebBrowser1.Document.ContextMenuShowing, AddressOf WebContextMenuShowing

I litterally copied your question and worked my google-fu on it...我一字不差地复制了你的问题并用我的google-fu来解决它......

This was on the first result page :-P这是在第一个结果页面上:-P

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM