首页 > 解决方案 > CefSharp新版IContextMenuHandler

问题描述

如何隐藏 CefSharp.WinForms.ChromiumWebBrowser 右键单击​​上下文菜单?

public class CustomMenuHandler : CefSharp.IContextMenuHandler 
{
    public void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
    {
        model.Clear();
    }

    public bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags)
    {

        return false;
    }

    public void OnContextMenuDismissed(IWebBrowser browserControl, IBrowser browser, IFrame frame)
    {

    }

    public bool RunContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model, IRunContextMenuCallback callback)
    {
        return false;
    }
}

以前我使用上面帖子中的代码来禁用 CefSharp 中的上下文菜单。随着最新的更新,CefSharp.IContextMenuHandler 不再存在

我怎样才能恢复这个功能?

在此处输入图像描述

标签: wpfcefsharp

解决方案


推荐阅读