其他分享
首页 > 其他分享> > CefSharp使用

CefSharp使用

作者:互联网

1,安装 CefSharp.WinForms 

2,禁用鼠标右键:

①新建类:

 class MenuNoneHandler : IContextMenuHandler
    {
        public void OnBeforeContextMenu(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
        {
            return;
        }

        public bool OnContextMenuCommand(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags)
        {
            return true;
        }

        public void OnContextMenuDismissed(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame)
        {
            return;
        }

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

②browser.MenuHandler = new MenuNoneHandler();

3,交互:

 

标签:CefSharp,return,chromiumWebBrowser,frame,IFrame,使用,public,browser
来源: https://www.cnblogs.com/li-guojiang/p/16229668.html