示例#1
0
 public static void DisplayContextMenu(Guid menuGroup, int contextMenuId, IInputElement routing)
 {
     Point position = Mouse.GetPosition(Application.Current.MainWindow);
     Point point2 = Application.Current.MainWindow.PointToScreen(position);
     ContextMenuRouter pCmdTrgtActive = new ContextMenuRouter(routing);
     IVsUIShell service = ServiceProvider.GetService(typeof(SVsUIShell)) as IVsUIShell;
     POINTS[] pos = new POINTS[1];
     pos[0].x = (short)point2.X;
     pos[0].y = (short)point2.Y;
     Guid rclsidActive = menuGroup;
     service.ShowContextMenu(0, ref rclsidActive, contextMenuId, pos, pCmdTrgtActive);
 }
        public static void DisplayContextMenu(Guid menuGroup, int contextMenuId, IInputElement routing)
        {
            Point             position       = Mouse.GetPosition(Application.Current.MainWindow);
            Point             point2         = Application.Current.MainWindow.PointToScreen(position);
            ContextMenuRouter pCmdTrgtActive = new ContextMenuRouter(routing);
            IVsUIShell        service        = ServiceProvider.GetService(typeof(SVsUIShell)) as IVsUIShell;

            POINTS[] pos = new POINTS[1];
            pos[0].x = (short)point2.X;
            pos[0].y = (short)point2.Y;
            Guid rclsidActive = menuGroup;

            service.ShowContextMenu(0, ref rclsidActive, contextMenuId, pos, pCmdTrgtActive);
        }