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:
This is the implementation for lazy people like me. It is based on CefSharp v53.0.0
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;
}
}
How to use it
ChromiumWebBrowser browser = new ChromiumWebBrowser();
browser.MenuHandler = new CustomMenuHandler();