예제 #1
0
 private void OnShowContextMenuTreeView(object sender, ShowContextMenuEventArgs e)
 {
     if (!e.UsingKeyboard)
     {
         ProjectTreeNode nodeAt = this._treeView.GetNodeAt(e.Location) as ProjectTreeNode;
         if (nodeAt != null)
         {
             this._treeView.SelectedNode = nodeAt;
         }
     }
     ICommandManager service = (ICommandManager) this.GetService(typeof(ICommandManager));
     if (service != null)
     {
         service.ShowContextMenu(typeof(GlobalCommands), 1, this, this._treeView.SelectedNode, this._treeView, e.Location);
     }
 }
예제 #2
0
 public int ShowContextMenu(int dwID, Interop.POINT pt, object pcmdtReserved, object pdispReserved)
 {
     ShowContextMenuEventArgs e = new ShowContextMenuEventArgs(this.hostControl.PointToClient(new Point(pt.x, pt.y)), false);
     try
     {
         this.hostControl.OnShowContextMenu(e);
     }
     catch
     {
     }
     return 0;
 }
예제 #3
0
 protected override void OnShowContextMenu(ShowContextMenuEventArgs e)
 {
     base.OnShowContextMenu(e);
     ICommandManager service = (ICommandManager) this.ServiceProvider.GetService(typeof(ICommandManager));
     this.FocusWindow();
     if (service != null)
     {
         service.ShowContextMenu(typeof(GlobalCommands), 3, null, null, this, e.Location);
     }
 }
예제 #4
0
 private void OnEditorShowContextMenu(object sender, ShowContextMenuEventArgs e)
 {
     ICommandManager service = (ICommandManager) this.ServiceProvider.GetService(typeof(ICommandManager));
     ((DocumentWindow) this.ServiceProvider.GetService(typeof(DocumentWindow))).Activate();
     if (service != null)
     {
         if (EditorTable.IsTableSelection(this._editor.Selection))
         {
             service.ShowContextMenu(typeof(WebCommands), 2, null, null, this, e.Location);
         }
         else
         {
             service.ShowContextMenu(typeof(WebCommands), 1, null, null, this, e.Location);
         }
     }
 }
예제 #5
0
 protected override void WndProc(ref Message msg)
 {
     bool flag = false;
     switch (msg.Msg)
     {
         case 0x100:
         {
             int wParam = (int) msg.WParam;
             flag = ((ICommandHandler) this._activeView).HandleCommand(new TextBufferCommand(80, wParam));
             Keys key = (Keys)((int)msg.WParam);
             if (!flag)
             {
                 flag = this.ProcessDialogKey(((Keys) ((int) msg.WParam)) | Control.ModifierKeys);
             }
             break;
         }
         case 0x102:
         {
             int commandVal = (int) msg.WParam;
             flag = ((ICommandHandler) this._activeView).HandleCommand(new TextBufferCommand(0x51, commandVal));
             break;
         }
         case 0x7b:
         {
             int lParam;
             int num4;
             bool keyboard = false;
             if (((int) msg.LParam) == -1)
             {
                 keyboard = true;
                 int messagePos = Interop.GetMessagePos();
                 lParam = messagePos & 0xffff;
                 num4 = (messagePos >> 0x10) & 0xffff;
             }
             else
             {
                 lParam = (short) ((int) msg.LParam);
                 num4 = ((int) msg.LParam) >> 0x10;
             }
             ShowContextMenuEventArgs e = new ShowContextMenuEventArgs(base.PointToClient(new Point(lParam, num4)), keyboard);
             this.OnShowContextMenu(e);
             flag = true;
             break;
         }
     }
     if (!flag)
     {
         base.WndProc(ref msg);
     }
 }
예제 #6
0
 protected virtual void OnShowContextMenu(ShowContextMenuEventArgs e)
 {
     ShowContextMenuEventHandler handler = (ShowContextMenuEventHandler) base.Events[this.EventShowContextMenu];
     if (handler != null)
     {
         handler(this, e);
     }
 }
예제 #7
0
 private void OnTrayIconShowContextMenu(object sender, ShowContextMenuEventArgs e)
 {
     if (this._trayMenu == null)
     {
         MxMenuItem item = new MxMenuItem("Show Details", string.Empty, new EventHandler(this.OnCommandShow));
         MxMenuItem item2 = new MxMenuItem("Restart", string.Empty, new EventHandler(this.OnCommandRestart));
         MxMenuItem item3 = new MxMenuItem("Stop", string.Empty, new EventHandler(this.OnCommandStop));
         MxMenuItem item4 = new MxMenuItem("Open in Web Browser", string.Empty, new EventHandler(this.OnCommandLaunch));
         this._trayMenu = new MxContextMenu(new MenuItem[] { item4, new MxMenuItem("-"), item2, item3, new MxMenuItem("-"), item });
     }
     this._trayMenu.Show(this, e.Location.X, e.Location.Y);
 }
예제 #8
0
 protected override void WndProc(ref Message m)
 {
     if (m.Msg == 0x7b)
     {
         int lParam;
         int num2;
         bool keyboard = false;
         if (((int) m.LParam) == -1)
         {
             keyboard = true;
             int messagePos = Interop.GetMessagePos();
             lParam = messagePos & 0xffff;
             num2 = (messagePos >> 0x10) & 0xffff;
         }
         else
         {
             lParam = (short) ((int) m.LParam);
             num2 = ((int) m.LParam) >> 0x10;
         }
         ShowContextMenuEventArgs e = new ShowContextMenuEventArgs(base.PointToClient(new Point(lParam, num2)), keyboard);
         this.OnShowContextMenu(e);
     }
     else
     {
         base.WndProc(ref m);
         if (this._multiLineToolTips && (m.Msg == 0x4e))
         {
             Interop.NMHDR nmhdr = (Interop.NMHDR) Marshal.PtrToStructure(m.LParam, typeof(Interop.NMHDR));
             if ((nmhdr.code == -530) || (nmhdr.code == -520))
             {
                 IntPtr hWnd = Interop.SendMessage(base.Handle, 0x104e, 0, 0);
                 if (hWnd != IntPtr.Zero)
                 {
                     Interop.SendMessage(hWnd, 0x418, 0, 600);
                 }
             }
         }
         if ((this._hasWatermark && (m.Msg == 15)) && (base.Items.Count == 0))
         {
             Graphics graphics = Graphics.FromHwndInternal(base.Handle);
             Rectangle clientRectangle = base.ClientRectangle;
             Brush brush = new SolidBrush(this.BackColor);
             graphics.FillRectangle(brush, clientRectangle);
             brush.Dispose();
             int num4 = 8;
             if ((base.View == View.Details) && (base.HeaderStyle != ColumnHeaderStyle.None))
             {
                 num4 += 20;
             }
             clientRectangle.Inflate(-8, -num4);
             StringFormat format = new StringFormat();
             format.LineAlignment = StringAlignment.Near;
             format.Alignment = StringAlignment.Center;
             graphics.DrawString(this._watermarkText, this.Font, SystemBrushes.ControlDark, clientRectangle, format);
             format.Dispose();
             graphics.Dispose();
         }
     }
 }
예제 #9
0
 private void OnGroupViewShowContextMenu(object sender, ShowContextMenuEventArgs e)
 {
     if (this._currentSection.IsCustomizable)
     {
         ToolboxDataGroupViewItem context = null;
         if (this._groupViewListView.SelectedItems.Count > 0)
         {
             context = (ToolboxDataGroupViewItem) this._groupView.SelectedItem;
         }
         ICommandManager service = (ICommandManager) this.GetService(typeof(ICommandManager));
         if (service != null)
         {
             service.ShowContextMenu(typeof(GlobalCommands), 2, this, context, this._groupViewListView, e.Location);
         }
     }
 }
예제 #10
0
파일: TrayIcon.cs 프로젝트: ikvm/webmatrix
 private void OnShowContextMenu()
 {
     if ((this._owner != null) && this._owner.IsHandleCreated)
     {
         ShowContextMenuEventHandler handler = (ShowContextMenuEventHandler) base.Events[EventShowContextMenu];
         if (handler != null)
         {
             Interop.POINT pt = new Interop.POINT();
             Interop.GetCursorPos(ref pt);
             Point p = new Point(pt.x, pt.y);
             p = this._owner.PointToClient(p);
             Interop.SetForegroundWindow(this._owner.Handle);
             ShowContextMenuEventArgs e = new ShowContextMenuEventArgs(p, false);
             handler(this, e);
             Interop.PostMessage(this._owner.Handle, 0, IntPtr.Zero, IntPtr.Zero);
         }
     }
 }
예제 #11
0
 protected override void WndProc(ref Message m)
 {
     if ((m.Msg == 0x7b) && (this.ContextMenu == null))
     {
         int lParam;
         int num2;
         bool keyboard = false;
         if (((int) m.LParam) == -1)
         {
             keyboard = true;
             int messagePos = Interop.GetMessagePos();
             lParam = messagePos & 0xffff;
             num2 = (messagePos >> 0x10) & 0xffff;
         }
         else
         {
             lParam = (short) ((int) m.LParam);
             num2 = ((int) m.LParam) >> 0x10;
         }
         ShowContextMenuEventArgs e = new ShowContextMenuEventArgs(base.PointToClient(new Point(lParam, num2)), keyboard);
         this.OnShowContextMenu(e);
     }
     else
     {
         base.WndProc(ref m);
         if ((this._hasWatermark && (m.Msg == 15)) && (base.Nodes.Count == 0))
         {
             Graphics graphics = Graphics.FromHwndInternal(base.Handle);
             Rectangle clientRectangle = base.ClientRectangle;
             Brush brush = new SolidBrush(this.BackColor);
             graphics.FillRectangle(brush, clientRectangle);
             brush.Dispose();
             clientRectangle.Inflate(-8, -8);
             StringFormat format = new StringFormat();
             format.LineAlignment = StringAlignment.Near;
             format.Alignment = StringAlignment.Center;
             graphics.DrawString(this._watermarkText, this.Font, SystemBrushes.ControlDark, clientRectangle, format);
             format.Dispose();
             graphics.Dispose();
         }
     }
 }