MenuHandler.cs 1.0 KB

123456789101112131415161718192021222324252627282930
  1. using CefSharp;
  2. namespace UAS_Web.tool
  3. {
  4. class MenuHandler : IContextMenuHandler
  5. {
  6. public void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
  7. {
  8. model.Clear();
  9. model.AddItem(CefMenuCommand.Copy, "复制");
  10. model.AddItem(CefMenuCommand.Paste, "粘贴");
  11. model.AddItem(CefMenuCommand.ReloadNoCache, "重新加载");
  12. }
  13. public bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags)
  14. {
  15. return false;
  16. }
  17. public void OnContextMenuDismissed(IWebBrowser browserControl, IBrowser browser, IFrame frame)
  18. {
  19. }
  20. public bool RunContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model, IRunContextMenuCallback callback)
  21. {
  22. return false;
  23. }
  24. }
  25. }