How do I hide the CefSharp.WinForms.ChromiumWebBrowser right click context menu?

前端 未结 5 1462
-上瘾入骨i
-上瘾入骨i 2021-02-07 01:01

I\'m using CefSharp.WinForms.ChromiumWebBrowser v45 in my project. When I right click into the web browser, the default context menu will show up:

5条回答
  •  情深已故
    2021-02-07 01:51

    webBrowser.PreviewMouseRightButtonDown += HandleWebBrowserPreviewMouseRightButton;
    webBrowser.PreviewMouseRightButtonUp += HandleWebBrowserPreviewMouseRightButton;
    
    private void HandleWebBrowserPreviewMouseRightButton(object sender, MouseButtonEventArgs e) {
                // Preventing right-click until https://github.com/cefsharp/CefSharp/issues/1915 is fixed
                e.Handled = true;
    }
    

提交回复
热议问题