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

前端 未结 5 1460
-上瘾入骨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:58

    The simplest way for you is set event PreviewMouseRightButtonUp and PreviewMouseRightButtonDown with the same function have e.Handle = true. This solution will not show context menu of cefsharp when you right click.

    XAML:

    
    

    And the function:

    private void Browser_PreviewMouseRightButton(object sender, MouseButtonEventArgs e)
    {
        e.Handled = true;
    }
    

提交回复
热议问题