简体   繁体   English

如何隐藏WebBrowser上下文菜单

[英]How to hide WebBrowser context menu

I want to disable the context menu in my WPF System.Windows.Controls.WebBrowser. 我想在WPF System.Windows.Controls.WebBrowser中禁用上下文菜单。 How would I do so? 我该怎么办?

将oncontextmenu属性添加到文档正文标签。

<body oncontextmenu="return false;">

Just use 只需使用

// Disable the Context menu inside the web browser
webBrowser1.IsWebBrowserContextMenuEnabled = false;

i tried this in Windows Applications 我在Windows应用程序中尝试过

Some useful links here , here and another one . 这里有一些有用的链接, 这里还有另一个

WPF WebBrowser Control has many Touch events that you could capture and handle and potentially stop the ContextMenu from ever popping up. WPF WebBrowser控件具有许多可以捕获和处理的Touch事件,并有可能阻止ContextMenu弹出。 Or you could supply your own ContextMenu for the browser to use. 或者,您可以提供自己的ContextMenu供浏览器使用。

The preview events are lower down on the page and can be used to intercept events that would cause the context menu to pop-up. 预览事件位于页面的下方,可用于拦截可能导致上下文菜单弹出的事件。

OnPreviewTouchDown OnPreviewTouchDown为

OnPreviewTouchMove OnPreviewTouchMove

OnPreviewTouchUp OnPreviewTouchUp

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

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