示例#1
0
        void CustomContextMenuManager_ShowContextMenu(object sender, WebKit.ShowContextMenuEventArgs e)
        {
            // Here we handle our custom menu implementation.
            // Remember that firstly we have set Browser.UseDefaultContextMenu = false
            // Otherwise this event will not be fired and the default webkit context
            // menu will be shown.
            ContextMenu Menu;

            if (e.MenuType == WebKit.ContextMenuType.Image)
            {
                Menu = imageContextMenu;
            }
            else if (e.MenuType == WebKit.ContextMenuType.ImageAndLink)
            {
                Menu = imageAndLinkContextMenu;
            }
            else if (e.MenuType == WebKit.ContextMenuType.Link)
            {
                Menu = linkContextMenu;
            }
            else if (e.MenuType == WebKit.ContextMenuType.Input)
            {
                Menu = inputContextMenu;
            }
            else if (e.MenuType == WebKit.ContextMenuType.Form)
            {
                Menu = formContextMenu;
            }
            else
            {
                Menu = normalContextMenu;
            }
            Menu.Show((sender as WebKitBrowser), e.Location);
        }
 void CustomContextMenuManager_ShowContextMenu(object sender, ShowContextMenuEventArgs e)
 {
     if (!webKitBrowser1.UseDefaultContextMenu)
     {
         ContextMenu tst = new ContextMenu();
         MenuItem mn = new MenuItem("Test1");
         tst.MenuItems.Add(mn);
         MenuItem mn2 = new MenuItem("Test2");
         tst.MenuItems.Add(mn2);
         MenuItem mn3 = new MenuItem("-");
         tst.MenuItems.Add(mn3);
         MenuItem mn4 = new MenuItem("Test3");
         tst.MenuItems.Add(mn4);
         tst.Show(webKitBrowser1, e.Location);
     }
 }