コード例 #1
0
        public static void ShowContextMenu(ContextMenuStrip contextMenu, DTE dte)
        {
            try
            {
                var serviceProvider = new ServiceProvider(dte as IServiceProvider);

                IVsUIShellOpenDocument sod = (IVsUIShellOpenDocument)serviceProvider.GetService(typeof(SVsUIShellOpenDocument));
                IVsUIHierarchy targetHier;
                uint[] targetId = new uint[1];
                IVsWindowFrame targetFrame;
                int isOpen;
                Guid viewId = new Guid(LogicalViewID.Primary);
                sod.IsDocumentOpen(null, 0, dte.ActiveWindow.Document.FullName,
                                   ref viewId, 0, out targetHier, targetId,
                                   out targetFrame, out isOpen);

                IVsTextView textView = VsShellUtilities.GetTextView(targetFrame);
                TextSelection selection = (TextSelection)dte.ActiveWindow.Document.Selection;
                Microsoft.VisualStudio.OLE.Interop.POINT[] interopPoint = new Microsoft.VisualStudio.OLE.Interop.POINT[1];
                textView.GetPointOfLineColumn(selection.ActivePoint.Line, selection.ActivePoint.LineCharOffset, interopPoint);

                POINT p = new POINT(interopPoint[0].x, interopPoint[0].y);

                ClientToScreen(textView.GetWindowHandle(), p);

                contextMenu.Show(new Point(p.x, p.y));
            }
            catch (Exception)
            {
                contextMenu.Show();
            }
        }
コード例 #2
0
        void dataGridView1_MouseClick(object Sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                //MessageBox.Show("LEFT");
                if (dataGridView1.CurrentRow.Cells[0].Value == null)
                {
                    return;
                }
                else
                {
                    dataGridView1[dataGridView1.CurrentCell.ColumnIndex, dataGridView1.CurrentCell.RowIndex].ReadOnly = false;
                }
            }
            else
            {
                ContextMenuStrip menu = new System.Windows.Forms.ContextMenuStrip();
                int posicionMouse     = dataGridView1.HitTest(e.X, e.Y).RowIndex;

                // MessageBox.Show("RIGHT");

                if (posicionMouse >= 0)
                {
                    menu.Items.Add("AGREGAR").Name   = "AGREGAR";
                    menu.Items.Add("MODIFICAR").Name = "MODIFICAR";
                    menu.Items.Add("ELIMINAR").Name  = "ELIMINAR";
                }
                menu.Show(dataGridView1, new Point(e.X, e.Y));

                //event menu click

                menu.ItemClicked += new ToolStripItemClickedEventHandler(menu_Item_Clicked);
            }
        }
コード例 #3
0
		void InterlinDocForAnalysis_RightMouseClickedEvent(SimpleRootSite sender, FwRightMouseClickEventArgs e)
		{
			e.EventHandled = true;
			// for the moment we always claim to have handled it.
			ContextMenuStrip menu = new ContextMenuStrip();

			// Add spelling items if any (i.e., if we clicked a squiggle word).
			int hvoObj, tagAnchor;
			if (GetTagAndObjForOnePropSelection(e.Selection, out hvoObj, out tagAnchor) &&
				(tagAnchor == SegmentTags.kflidFreeTranslation || tagAnchor == SegmentTags.kflidLiteralTranslation ||
				tagAnchor == NoteTags.kflidContent))
			{
				var helper = new SpellCheckHelper(Cache);
				helper.MakeSpellCheckMenuOptions(e.MouseLocation, this, menu);
			}

			int hvoNote;
			if (CanDeleteNote(e.Selection, out hvoNote))
			{
				if (menu.Items.Count > 0)
				{
					menu.Items.Add(new ToolStripSeparator());
				}
				// Add the delete item.
				string sMenuText = ITextStrings.ksDeleteNote;
				ToolStripMenuItem item = new ToolStripMenuItem(sMenuText);
				item.Click += OnDeleteNote;
				menu.Items.Add(item);
			}
			if (menu.Items.Count > 0)
			{
				e.Selection.Install();
				menu.Show(this, e.MouseLocation);
			}
		}
コード例 #4
0
        private void snapShotDataTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Button != MouseButtons.Right) { return; }
            snapShotDataTree.SelectedNode = e.Node;
            if (!(e.Node is CallNode)) return;
            CallNode tmpNode = (CallNode)e.Node;
            Csta.ConnectionID_t selectedConnId = tmpNode.connection;
            ContextMenuStrip snapShotDataTreeContextMenu = new ContextMenuStrip();
            ToolStripItem cstaClearCallContextMenuItem = snapShotDataTreeContextMenu.Items.Add("cstaClearCall");
            ToolStripItem cstaClearConnectionContextMenuItem = snapShotDataTreeContextMenu.Items.Add("cstaClearConnection");
            cstaClearCallContextMenuItem.Click += (s, ev) =>
            {
                Csta.EventBuffer_t evtbuf = Csta.clearCall(this.parentForm.acsHandle, selectedConnId);
                if (evtbuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtbuf.evt.eventHeader.eventType.eventType == Csta.CSTA_CLEAR_CALL_CONF)
                {
                    snapShotDataTree.Nodes.Remove(tmpNode);
                }
            };

            cstaClearConnectionContextMenuItem.Click += (s, ev) =>
            {
                Csta.EventBuffer_t evtbuf = Csta.clearConnection(parentForm.acsHandle, parentForm.privData, selectedConnId);
                if (evtbuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtbuf.evt.eventHeader.eventType.eventType == Csta.CSTA_CLEAR_CONNECTION_CONF)
                {
                    snapShotDataTree.Nodes.Remove(tmpNode);
                }
            };

            snapShotDataTreeContextMenu.Show(Cursor.Position);
        }
コード例 #5
0
        private void gridKursUebersicht_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right) // Rechtsklick
            {
                // ContextMenuStrip mit ToolStipMenuItem erzeugen
                ContextMenuStrip myContextMenu = new ContextMenuStrip();
                ToolStripMenuItem toolStripItemUebersichtAktualisieren = new ToolStripMenuItem("Aktualisieren (F5)");

                // Items hinzufügen
                myContextMenu.Items.Add(toolStripItemUebersichtAktualisieren);

                // Bild hinzufuegen
                toolStripItemUebersichtAktualisieren.Image = PuG_Verwaltungssoftware.Properties.Resources.pug_refresh;

                // Handler der Items
                toolStripItemUebersichtAktualisieren.Click += new EventHandler(toolStripItemUebersichtAktualisieren_Click);

                int currentMouseOverRow = gridKursUebersicht.HitTest(e.X, e.Y).RowIndex;

                if (currentMouseOverRow >= 0) // In der Tabelle
                {
                    // Nix
                }

                myContextMenu.Show(gridKursUebersicht, new Point(e.X, e.Y));
            }
        }
コード例 #6
0
        private void ListBox_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                ListBox.SelectedIndex = ListBox.IndexFromPoint(e.Location);

                if (ListBox.SelectedIndex != -1)
                {
                    ContextMenuStrip contextMenuStrip = new ContextMenuStrip();

                    contextMenuStrip.Items.Add(mMoveToTop);
                    contextMenuStrip.Items.Add(mMoveUp);
                    contextMenuStrip.Items.Add(mMoveDown);
                    contextMenuStrip.Items.Add(mMoveToBottom);

                    Point point = new Point(
                        System.Windows.Forms.Cursor.Position.X,
                        System.Windows.Forms.Cursor.Position.Y);

                    contextMenuStrip.Show(point);
                }
            }
            else if(this.ListBox.SelectedItem != null)
            {
                // Code from:
                // http://stackoverflow.com/questions/805165/reorder-a-winforms-listbox-using-drag-and-drop
                this.ListBox.DoDragDrop(this.ListBox.SelectedItem, DragDropEffects.Move);
            }
        }
コード例 #7
0
ファイル: Globals.cs プロジェクト: Enoz/InfiniPad
        public static Color requestColorDialog(Control sender)
        {
            Color res = Color.Empty;
            ContextMenuStrip cm = new ContextMenuStrip();
            var ColorDic = new Dictionary<string, Color>();

            ColorDic.Add("Red", Color.Red);
            ColorDic.Add("Blue", Color.Blue);
            ColorDic.Add("Yellow", Color.Yellow);
            ColorDic.Add("Green", Color.Green);
            ColorDic.Add("Transparent", Color.FromArgb(0, 255, 255, 255));

            foreach ( KeyValuePair<string, Color> pair in ColorDic)
            {
                Bitmap bmp = new Bitmap(10, 10);
                for(int k = 0; k < bmp.Width; k++)
                {
                    for(int v = 0; v < bmp.Height; v++)
                    {
                        bmp.SetPixel(k, v, pair.Value);
                    }
                }
                cm.Items.Add(new ToolStripMenuItem(pair.Key, bmp, (s, e) => { res = pair.Value; }));
            }
            cm.Items.Add(new ToolStripMenuItem("Custom...", new Bitmap(1, 1), (s, e) => { res = oldDialogPicker(); }));

            cm.Show(sender, sender.PointToClient(new Point(Cursor.Position.X, Cursor.Position.Y)));
            cm.Focus();
            while (cm.Visible == true) { Application.DoEvents(); }
            return res;
        }
コード例 #8
0
 private void myDataGridView_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     //如果是右击
     if (e.Button == Windows.Forms.MouseButtons.Right)
     {
         if (e.RowIndex != this.Rows.Count)
         {
             //如果行数只有一行
             if (this.Rows.Count <= 1)
             {
                 this.ToolStripMenuItemRemove.Enabled = false;
             }
             else
             {
                 this.ToolStripMenuItemRemove.Enabled = true;
             }
             //选择右击项的那一行
             this.ClearSelection();
             this.Rows[e.RowIndex].Selected = true;
             //显示菜单栏
             CMS_RowHeader.Show();
             CMS_RowHeader.Left = MousePosition.X;
             CMS_RowHeader.Top  = MousePosition.Y;
         }
     }
 }
コード例 #9
0
ファイル: EntryMenu.cs プロジェクト: ashwingj/keepass2
        public static void Show(int iPosX, int iPosY)
        {
            EntryMenu.Destroy();

            m_ctx = EntryMenu.Construct();
            m_ctx.Show(iPosX, iPosY);
        }
コード例 #10
0
        public static void ShowContextMenu(IMenuCommandService service, Control owner, int x, int y)
        {
            var menu = new ContextMenuStrip();
            menu.Items.AddRange(GetMenuItems(service.Verbs));
            menu.Show(owner, x, y);

        }
コード例 #11
0
        private void Table_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                if (e.Button == MouseButtons.Left)
                {
                    //    Qtes = datarticle.SelectedRows[0].Cells[3].Value.ToString();
                    //    code = datarticle.SelectedRows[0].Cells[2].Value.ToString();
                    //    Barcode = datarticle.SelectedRows[0].Cells[4].Value.ToString();
                    //    code_facture = datarticle.SelectedRows[0].Cells[1].Value.ToString();
                }
                else
                {
                    ContextMenuStrip my_menu = new System.Windows.Forms.ContextMenuStrip();
                    int position_row         = Table.HitTest(e.X, e.Y).RowIndex;
                    if (position_row >= 0)
                    {
                        my_menu.Items.Add("Modifier votre compte").Name = "Modifier votre compte";
                    }
                    my_menu.Show(Table, new Point(e.X, e.Y));

                    my_menu.ItemClicked += new ToolStripItemClickedEventHandler(my_menuItemclicked);
                    my_menu.ItemClicked += new ToolStripItemClickedEventHandler(my_menuItemclickeds);
                }
            }
            catch (Exception ex) { MessageBox.Show("Erreur"); }
        }
コード例 #12
0
 /// <summary>
 /// Tray icon right click opens menu strip
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TrayNotifyIcon_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         TrayContextMenuStrip.Show();
     }
 }
コード例 #13
0
 void ButtonMouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         ContextMenuStrip  CMS = new System.Windows.Forms.ContextMenuStrip();
         ToolStripMenuItem t1  = new ToolStripMenuItem("Существенная игра");
         t1.Click += (new_sender, new_e) => ChangeButtonColor(sender, e, true);
         ToolStripMenuItem t2 = new ToolStripMenuItem("Несущественная игра");
         t2.Click += (new_sender, new_e) => ChangeButtonColor(sender, e, false);
         CMS.Items.Add(t1);
         CMS.Items.Add(t2);
         CMS.Show(MousePosition);
     }
     if (e.Button == System.Windows.Forms.MouseButtons.Left)
     {
         CooperativeGameForm F = new CooperativeGameForm(this, (sender as Button).Text);
         F.StartPosition = FormStartPosition.CenterScreen;
         if (CGStudentProgress.CurrentSection > 2)
         {
             F.Show();
         }
         else
         {
             F.ShowDialog();
         }
     }
 }
コード例 #14
0
        private void dataGridUrunler_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                try
                {
                    ContextMenuStrip clickMenu = new System.Windows.Forms.ContextMenuStrip();
                    int clickedIndex           = dataGridUrunler.HitTest(e.X, e.Y).RowIndex;

                    if (clickedIndex >= 0)
                    {
                        SecilenUrunID       = Convert.ToInt32(dataGridUrunler.Rows[clickedIndex].Cells[0].Value);
                        SecilenUrunRowIndex = clickedIndex;
                        string         urunAd        = dataGridUrunler.Rows[clickedIndex].Cells[1].Value.ToString();
                        ToolStripLabel tempToolStrip = new ToolStripLabel(urunAd);
                        tempToolStrip.ForeColor = Color.DodgerBlue;
                        tempToolStrip.Font      = new Font("Century Gothic", 14, FontStyle.Bold);
                        clickMenu.Items.Insert(0, tempToolStrip);
                        clickMenu.Items.Insert(1, new ToolStripLabel("--------"));
                        clickMenu.Items.Add("Ürünü Sil");
                        clickMenu.Items.Add("Ürünü Düzenle");
                        clickMenu.Items.Add("Ürünü Ekranda Göster");
                    }
                    clickMenu.Show(dataGridUrunler, e.X, e.Y);
                    clickMenu.ItemClicked += new ToolStripItemClickedEventHandler(clickMenu_ItemCliked);
                }
                catch
                {
                    return;
                }
            }
        }
コード例 #15
0
 private void OnMouseClick(object sender, MouseEventArgs e)
 {
     ChangeFocus(null);
     if (e.Button == MouseButtons.Right)
     {
         fieldMenu.Show(MousePosition);
     }
 }
コード例 #16
0
 void ShowMenu()
 {
     ContextMenuStrip menu = new ContextMenuStrip();
     menu.Items.Add(defaultText).Click += new EventHandler(defaultItem_Click);
     foreach (TreeNode n in TopResource.Node.Nodes)
         menu.Items.Add(CreateItem(n.Tag as IResourceView));
     menu.Show(MousePosition);
 }
コード例 #17
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Creates and shows a context menu with spelling suggestions.
		/// </summary>
		/// <param name="pt">The location on the screen of the word for which we want spelling
		/// suggestions (usually the mouse position)</param>
		/// <param name="rootsite">The focused rootsite</param>
		/// <returns><c>true</c> if a menu was created and shown (with at least one item);
		/// <c>false</c> otherwise</returns>
		/// -----------------------------------------------------------------------------------
		public bool ShowContextMenu(Point pt, SimpleRootSite rootsite)
		{
			ContextMenuStrip menu = new ContextMenuStrip();
			MakeSpellCheckMenuOptions(pt, rootsite, menu);
			if (menu.Items.Count == 0)
				return false;
			menu.Show(rootsite, pt);
			return true;
		}
コード例 #18
0
ファイル: Bucket.cs プロジェクト: shibafu528/CapBucket
 private void btnSaveAs_Click(object sender, EventArgs e)
 {
     var toolStrip = new ContextMenuStrip();
     foreach (var transposer in _transposers)
     {
         toolStrip.Items.Add(transposer.GetType().Name);
     }
     toolStrip.Show(btnSaveAs, new Point(0, btnSaveAs.Height));
 }
コード例 #19
0
 public override bool HandleMouseDown(Point p)
 {
     CheckDisposed();
     System.Windows.Forms.ContextMenuStrip contextMenuStrip = SetupContextMenuStrip();
     if (contextMenuStrip.Items.Count > 0)
     {
         contextMenuStrip.Show(TreeNode, p);
     }
     return(true);
 }
コード例 #20
0
        //protected override void OnValidating(CancelEventArgs e)
        //{
        //    base.OnValidating(e);
        //}

        protected virtual void OnMouseUp(object sender, MouseEventArgs mouseEventArgs)
        {
            if (mouseEventArgs.Button == MouseButtons.Right)
            {
                cmsPicBox.Show(MousePosition);
            }

            _clickedPoint = null;
            Cursor        = System.Windows.Forms.Cursors.Default;
        }
コード例 #21
0
ファイル: StudyFilterTableView.cs プロジェクト: nhannd/Xian
		private static void ShowContextMenu(ContextMenuStrip contextMenuStrip, ActionModelNode actionModel, Point screenPoint, int minWidth, bool alignRight)
		{
			ToolStripBuilder.Clear(contextMenuStrip.Items);
			if (actionModel != null)
			{
				ToolStripBuilder.BuildMenu(contextMenuStrip.Items, actionModel.ChildNodes);
				if (alignRight)
					screenPoint.Offset(-contextMenuStrip.Width, 0);
				contextMenuStrip.Show(screenPoint);
			}
		}
コード例 #22
0
        private void listFiles_MouseClick(object sender, MouseEventArgs e)
        {
            if ((e.Button != MouseButtons.Right) ||
                (listFiles.SelectedItems.Count == 0))
            {
                return;
            }
            System.Windows.Forms.ContextMenuStrip contextMenu = new System.Windows.Forms.ContextMenuStrip();

            System.Windows.Forms.ToolStripMenuItem item = new System.Windows.Forms.ToolStripMenuItem("Export");
            item.Tag = 0;
            contextMenu.Items.Add(item);

            System.Windows.Forms.ToolStripMenuItem subItem = new System.Windows.Forms.ToolStripMenuItem("Export to file");
            subItem.Tag    = 0;
            subItem.Click += new EventHandler(itemExport_Click);
            item.DropDownItems.Add(subItem);

            bool exportToBasicPossible = true;

            foreach (ListViewItem listItem in listFiles.SelectedItems)
            {
                C64Studio.Types.FileInfo fileInfo = (C64Studio.Types.FileInfo)listItem.Tag;
                if (fileInfo.Type != C64Studio.Types.FileType.PRG)
                {
                    exportToBasicPossible = false;
                }
            }
            if (exportToBasicPossible)
            {
                subItem        = new System.Windows.Forms.ToolStripMenuItem("Export to Basic code");
                subItem.Tag    = 0;
                subItem.Click += new EventHandler(itemExportToBasic_Click);
                item.DropDownItems.Add(subItem);
            }

            // view in Hex display
            item        = new System.Windows.Forms.ToolStripMenuItem("View in Hex Editor");
            item.Tag    = 2;
            item.Click += new EventHandler(itemViewInHexEditor_Click);
            contextMenu.Items.Add(item);

            item        = new System.Windows.Forms.ToolStripMenuItem("Rename");
            item.Tag    = 2;
            item.Click += new EventHandler(itemRename_Click);
            contextMenu.Items.Add(item);

            item        = new System.Windows.Forms.ToolStripMenuItem("Delete");
            item.Tag    = 1;
            item.Click += new EventHandler(itemDelete_Click);
            contextMenu.Items.Add(item);

            contextMenu.Show(listFiles.PointToScreen(e.Location));
        }
コード例 #23
0
        public System.Windows.Forms.ContextMenuStrip ShowContextMenu(System.Windows.Forms.Control parent, List<MySQL.Base.MenuItem> items, int x, int y)
        {
            System.Windows.Forms.ContextMenuStrip menu = new System.Windows.Forms.ContextMenuStrip();
              System.Windows.Forms.ToolStripItem[] itemList;

              itemList = buildMenu(items, new EventHandler(menuItem_Click));
              menu.Items.AddRange(itemList);

              menu.Show(parent, new System.Drawing.Point(x, y), ToolStripDropDownDirection.BelowRight);

              return menu;
        }
コード例 #24
0
 private void button9_Click(object sender, EventArgs e)
 {
     System.Windows.Forms.ContextMenuStrip menu = new ContextMenuStrip();
     foreach (ObjectResourceView res in Program.Objects.Values)
     {
         ToolStripMenuItem collisionObjectMenuItem = new ToolStripMenuItem(res.Name);
         collisionObjectMenuItem.Tag = res;
         collisionObjectMenuItem.Click += new EventHandler(collisionObjectMenuItem_Click);
         menu.Items.Add(collisionObjectMenuItem);
     }
     menu.Show(MousePosition);
 }
コード例 #25
0
        public System.Windows.Forms.ContextMenuStrip ShowContextMenu(System.Windows.Forms.Control parent, List <MySQL.Base.MenuItem> items,
                                                                     int x, int y, EventHandler handler)
        {
            System.Windows.Forms.ContextMenuStrip menu = new System.Windows.Forms.ContextMenuStrip();
            System.Windows.Forms.ToolStripItem[]  itemList;

            itemList = buildMenu(items, handler);
            menu.Items.AddRange(itemList);

            menu.Show(parent, new System.Drawing.Point(x, y), ToolStripDropDownDirection.BelowRight);
            return(menu);
        }
コード例 #26
0
 private void NotClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         var _Backt = new img_backdrop();
         _Backt.Show();
     }
     else if (e.Button == MouseButtons.Right)
     {
         notifystrip.Show();
     }
 }
コード例 #27
0
        // Handle tab control mouse up - used for custom close interaction
        private void ExtendedTabControl_MouseUp(object sender, MouseEventArgs e)
        {
            if (!ShowTabCloseArea)
            {
                return;
            }

            Rectangle r           = GetTabRect(SelectedIndex);
            Rectangle closeButton = new Rectangle(r.Right - TabCloseWidth, r.Top + 4, 10, 10);

            // Left click, check for tab close
            if (e.Button == MouseButtons.Left && closeButton.Contains(e.Location))
            {
                // Remove tab if a close click detected
                CloseTab(SelectedTab);
            }
            // Right click, show tab context menu
            else if (e.Button == MouseButtons.Right)
            {
                // First go through and get the tab that was right-clicked
                Point p = PointToClient(Cursor.Position);
                for (int i = 0; i < TabCount; i++)
                {
                    r = GetTabRect(i);

                    if (r.Contains(p))
                    {
                        SelectedIndex = i; // i is the index of tab under cursor
                        tabToLeave    = SelectedTab;
                        break;
                    }
                }

                // Now show the context menu
                tabContextMenuStrip.Show(this, e.Location);
            }
            else if (e.Button == MouseButtons.Middle)
            {
                // Go through and get the tab that was middle-clicked
                Point p = PointToClient(Cursor.Position);
                for (int i = 0; i < TabCount; i++)
                {
                    r = GetTabRect(i);

                    if (r.Contains(p))
                    {
                        CloseTab(TabPages[i]);
                        break;
                    }
                }
            }
        }
コード例 #28
0
 private void TreeNode_NodeMouseClick(object sender, System.Windows.Forms.TreeNodeMouseClickEventArgs e)
 {
     oTreeView.SelectedNode = e.Node;
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         System.Windows.Forms.ContextMenuStrip oContextMenu = this.GetContextMenu();
         if (oContextMenu != null)
         {
             System.Drawing.Point oPoint = new System.Drawing.Point(e.Node.Bounds.X + oTreeView.Left + 5, e.Node.Bounds.Y + oTreeView.Top + 15);
             oContextMenu.Show(this, oPoint);
         }
     }
 }
コード例 #29
0
ファイル: PopupListBox.cs プロジェクト: johnmensen/TradeSharp
 public void ShowOptions(int x, int y)
 {
     var menu = new ContextMenuStrip();
     var index = 0;
     foreach (var str in stringValues)
     {
         var item = (ToolStripMenuItem)menu.Items.Add(str);
         item.Click += ItemOnClick;
         if (index++ == selectedIndex)
             item.Checked = true;
     }
     menu.Show(parent, x, y);
 }
コード例 #30
0
ファイル: cViewerText.cs プロジェクト: cyrenaique/HCSA
        private void chart_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                CompleteMenu = new ContextMenuStrip();

                ToolStripMenuItem ToolStripMenuItem_DisplayTable = new ToolStripMenuItem("Clear");
                CompleteMenu.Items.Add(ToolStripMenuItem_DisplayTable);
                ToolStripMenuItem_DisplayTable.Click += new System.EventHandler(this.ClearPanel);

                CompleteMenu.Show(Control.MousePosition);
            }
        }
コード例 #31
0
ファイル: QrcodeForm.cs プロジェクト: xxy1991/cozy
 private void qrCodeImgControl1_MouseDown(object sender, MouseEventArgs e)
 {
     if(e.Button == MouseButtons.Right)
     {
         ContextMenuStrip rightOperation = new ContextMenuStrip();
         ToolStripMenuItem copyImage = new ToolStripMenuItem("复制图片");
         copyImage.Click += copyImage_Click;
         ToolStripMenuItem saveImage = new ToolStripMenuItem("保存图片");
         saveImage.Click += saveImage_Click;
         rightOperation.Items.Add(copyImage);
         rightOperation.Items.Add(saveImage);
         rightOperation.Show(qrCodeImgControl1, e.Location);
     }
 }
コード例 #32
0
 private void tb_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         ContextMenuStrip pop = new System.Windows.Forms.ContextMenuStrip();
         int position         = tb.HitTest(e.X, e.Y).RowIndex;
         if (position >= 0)
         {
             pop.Items.Add("Edito").Name = "Edito";
             pop.Items.Add("Fshij").Name = "Fshij";
         }
         pop.Show(tb, new Point(e.X, e.Y));
     }
 }
コード例 #33
0
ファイル: ChatWindow.cs プロジェクト: TerryXY/DevProLauncher
        private void Chat_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                if (ChatLog.SelectedText == "") return;
                ContextMenuStrip mnu = new ContextMenuStrip();
                ToolStripMenuItem mnucopy = new ToolStripMenuItem("Copy");

                mnucopy.Click += new EventHandler(CopyText);

                mnu.Items.Add(mnucopy);

                mnu.Show(ChatLog, e.Location);
            }
        }
コード例 #34
0
ファイル: Form1.cs プロジェクト: RichardPorter/TrayFinance
 private void listView1_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         this.selectedTicker = "";
         rightClickTicker.Show(Cursor.Position);
         foreach (ListViewItem item in listView1.Items)
         {
             if (item.Bounds.Contains(new Point(e.X, e.Y)))
             {
                 this.selectedTicker = item.Text;
             }
         }
     }
 }
コード例 #35
0
ファイル: ctlUserView.cs プロジェクト: jango2015/MongoCola
 protected void lstData_MouseClick(object sender, MouseEventArgs e)
 {
     RuntimeMongoDbContext.SelectObjectTag = MDataViewInfo.StrDbTag;
     if (lstData.SelectedItems.Count > 0)
     {
         if (e.Button == MouseButtons.Right)
         {
             contextMenuStripMain = new ContextMenuStrip();
             contextMenuStripMain.Items.Add(AddUserToolStripMenuItem.Clone());
             contextMenuStripMain.Items.Add(ChangePasswordToolStripMenuItem.Clone());
             contextMenuStripMain.Items.Add(RemoveUserToolStripMenuItem.Clone());
             contextMenuStripMain.Show(lstData.PointToScreen(e.Location));
         }
     }
 }
コード例 #36
0
 private void dgvAddedProducts_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         ContextMenuStrip my_menu = new System.Windows.Forms.ContextMenuStrip();
         int position_mouse_click = dgvAddedProducts.HitTest(e.X, e.Y).RowIndex;
         if (position_mouse_click >= 0)
         {
             my_menu.Items.Add("Edit").Name   = "Edit";
             my_menu.Items.Add("Delete").Name = "Delete";
         }
         my_menu.Show(dgvAddedProducts, new Point(e.X, e.Y));
         my_menu.ItemClicked += new ToolStripItemClickedEventHandler(my_menu_ItemClicked);
     }
 }
コード例 #37
0
 void RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if ((e.Button == System.Windows.Forms.MouseButtons.Left) && (CGStudentProgress.CurrentSection == 2))
     {
         ((sender as DataGridView).Tag as UI.Grid).
         BeginEdit((sender as DataGridView).Rows[e.RowIndex].HeaderCell);
     }
     if ((e.Button == System.Windows.Forms.MouseButtons.Right) && (CGStudentProgress.CurrentSection == 3))
     {
         ContextMenuStrip  CMS = new System.Windows.Forms.ContextMenuStrip();
         ToolStripMenuItem t1  = new ToolStripMenuItem("Удалить");
         t1.Click += (new_sender, new_e) => Dominate(sender, e, (sender as DataGridView).Rows[e.RowIndex]);
         CMS.Items.Add(t1);
         CMS.Show(MousePosition);
     }
 }
        private void EditBtn_Click(object sender, RoutedEventArgs e)
        {
            //Initalize the context menu strip

            contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip();
            //  contextMenuStrip1.Font=FontFamily.FamilyNam
            System.Windows.Forms.ToolStripMenuItem mI1 = new System.Windows.Forms.ToolStripMenuItem();
            System.Windows.Forms.ToolStripMenuItem mI2 = new System.Windows.Forms.ToolStripMenuItem();
            System.Windows.Forms.ToolStripMenuItem mI3 = new System.Windows.Forms.ToolStripMenuItem();
            System.Windows.Forms.ToolStripMenuItem mI4 = new System.Windows.Forms.ToolStripMenuItem();
            System.Windows.Forms.ToolStripMenuItem mI5 = new System.Windows.Forms.ToolStripMenuItem();
            System.Windows.Forms.ToolStripMenuItem mI6 = new System.Windows.Forms.ToolStripMenuItem();
            mI1.Text = "تیزی تصویر";
            mI2.Text = "وضوح";
            mI3.Text = "روشنایی";
            mI4.Text = "بازیابی تصویر اولیه";
            mI5.Text = "پیش نمایش";
            mI6.Text = "ذخیره";
            contextMenuStrip1.Items.Add(mI1);
            contextMenuStrip1.Items.Add(mI2);
            contextMenuStrip1.Items.Add(mI3);
            contextMenuStrip1.Items.Add(mI4);
            contextMenuStrip1.Items.Add(mI5);
            contextMenuStrip1.Items.Add(mI6);

            mI1.Click += new EventHandler(sharpenImageToolStripMenuItem_Click); //Add Click Handler
            mI2.Click += new EventHandler(contrastToolStripMenuItem_Click);     //Add Click Handler
            mI3.Click += new EventHandler(brightnessToolStripMenuItem_Click);   //Add Click Handler
            mI4.Click += new EventHandler(restoreImageToolStripMenuItem_Click); //Add Click Handler
            mI5.Click += new EventHandler(previewToolStripMenuItem_Click);      //Add Click Handler
            mI6.Click += new EventHandler(SaveImagetoolStripMenuItem_Click);    //Add Click Handler

            //Initalize Notify Icon

            m_notifyIcon = new System.Windows.Forms.NotifyIcon();

            m_notifyIcon.Text = "Application Title";

            //m_notifyIcon.Icon = new System.Drawing.Icon("Icon.ico");

            m_notifyIcon.ContextMenuStrip = contextMenuStrip1;  //Associate the contextmenustrip with notify icon

            contextMenuStrip1.Show(830, 400);
            m_notifyIcon.Visible   = true;
            SkinColorBtn.IsEnabled = true;
            EditBtn.BorderBrush    = System.Windows.Media.Brushes.Green;
        }
コード例 #39
0
        /// <summary>
        ///     数据列表右键菜单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void lstData_MouseClick(object sender, MouseEventArgs e)
        {
            if (mDataViewInfo.IsView) return; //View是只读的

            RuntimeMongoDbContext.SelectObjectTag = mDataViewInfo.strCollectionPath;
            if (lstData.SelectedItems.Count > 0)
            {
                if (e.Button == MouseButtons.Right)
                {
                    contextMenuStripMain = new ContextMenuStrip();
                    contextMenuStripMain.Items.Add(NewDocumentToolStripMenuItem.Clone());
                    contextMenuStripMain.Items.Add(OpenDocInEditorToolStripMenuItem.Clone());
                    contextMenuStripMain.Items.Add(DelSelectRecordToolToolStripMenuItem.Clone());
                    contextMenuStripMain.Show(lstData.PointToScreen(e.Location));
                }
            }
        }
コード例 #40
0
        private void MoreButtonClick(object sender, EventArgs e)
        {
            dropDown.Items.Clear();
            // dropDown.BackColor = UI.passiveBackColor;
            // dropDown.ForeColor = Color.White;
            // render background color: https://stackoverflow.com/questions/25425948/c-sharp-winforms-toolstripmenuitem-change-background
            foreach (NiceTab t in visibleTabs)
            {
                ToolStripMenuItem item = dropDown.Items.Add(t.Text) as ToolStripMenuItem;
                item.ImageScaling = ToolStripItemImageScaling.None;
                item.Checked      = SelectedTab == t;
                item.Tag          = t.TabIndex;
                item.Click       += new EventHandler(OnDropdownItemSelected);
            }

            dropDown.Show(PointToScreen(new Point(moreTabsButton.Right, Bottom)), ToolStripDropDownDirection.BelowLeft);
        }
コード例 #41
0
        private void tablaConsultas_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                ContextMenuStrip menu = new System.Windows.Forms.ContextMenuStrip();
                int position          = tablaConsultas.HitTest(e.X, e.Y).RowIndex;

                if (position >= 0)
                {
                    menu.Items.Add("Actualizar").Name = "Actualizar";
                    menu.Items.Add("Eliminar").Name   = "Eliminar";
                    peliculaSeleccionada = (tablaConsultas[0, position].Value.ToString());
                }
                menu.Show(tablaConsultas, new Point(e.X, e.Y));
                menu.ItemClicked += new ToolStripItemClickedEventHandler(menu_ItemClicked);
            }
        }
コード例 #42
0
 /*显示操作菜单
  *
  */
 /// <summary>
 /// 显示菜单
 /// </summary>
 /// <param name="control">显示的父控件</param>
 /// <param name="x">x相对位置</param>
 /// <param name="y">y相对位置</param>
 /// <returns>系统错误类型枚举</returns>
 public SystemErrorType ShowMenus(Control control, int x, int y)
 {
     if (ChoosedLayer == null)
     {
         return(SystemErrorType.enumParamIsNull);
     }
     try
     {
         CreateMenuItem();
         PopMenuLayerPreoperty.Show(control, x, y);
     }
     catch (Exception)
     {
         return(SystemErrorType.enumSystemControlHandleFail);
     }
     return(SystemErrorType.enumOK);
 }
コード例 #43
0
        private void botListDGV_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                ContextMenuStrip actions = new System.Windows.Forms.ContextMenuStrip();
                int positionRow          = botListDGV.HitTest(e.X, e.Y).RowIndex;
                int positionColumn       = botListDGV.HitTest(e.X, e.Y).ColumnIndex;
                if (positionRow > -1)
                {
                    actions.Items.Add("Interact").Name  = "Interact";
                    actions.Items.Add("ListUsers").Name = "ListUsers";
                }
                actions.Show(botListDGV, new Point(e.X, e.Y));

                actions.ItemClicked += new ToolStripItemClickedEventHandler((s, er) => actions_ItemClicked(s, er, positionRow));
            }
        }
コード例 #44
0
 private void OnElementMouseDown(object sender, MouseEventArgs e)
 {
     if (sender != Focus)
     {
         var lastFocus = Focus;
         ChangeFocus(sender as FieldElement);
         FocusChanged?.Invoke(lastFocus, Focus);
     }
     if (e.Button == MouseButtons.Right)
     {
         elementMenu.Show(MousePosition);
     }
     else if (e.Button == MouseButtons.Left)
     {
         StartDrag();
     }
 }
コード例 #45
0
ファイル: Form1.cs プロジェクト: thalukanyomulaudzi/Techno
        /*Combo Grid Mouse Click Func*/

        void supplierClick(Object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                ContextMenuStrip myMenu = new System.Windows.Forms.ContextMenuStrip();
                int position_xy__row    = dgvStock.HitTest(e.X, e.Y).RowIndex;
                if (position_xy__row >= 0)
                {
                    myMenu.Items.Add("Delete").Name = "Deleted";
                    myMenu.Items.Add("View").Name   = "View";
                }


                myMenu.Show(dgvStock, new Point(e.X, e.Y));
                myMenu.ItemClicked += new ToolStripItemClickedEventHandler(myMenu_ItemClicked);
            }
        }
コード例 #46
0
 private void dgvCTHD_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
     }
     else
     {
         ContextMenuStrip menu     = new System.Windows.Forms.ContextMenuStrip();
         int position_xy_mouse_row = dgvCTHD.HitTest(e.X, e.Y).RowIndex;
         nuttam = position_xy_mouse_row;
         if (position_xy_mouse_row >= 0)
         {
             menu.Items.Add("Xóa").Name = "Xoa";
         }
         menu.Show(dgvCTHD, new Point(e.X, e.Y));
         menu.ItemClicked += new ToolStripItemClickedEventHandler(menu_ItemClicked);
     }
 }
コード例 #47
0
ファイル: ScopeUser.cs プロジェクト: shardakov/schema_maker
 private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         ContextMenuStrip myMenu = new System.Windows.Forms.ContextMenuStrip();
         myMenu.Items.Add("Назвать").Name  = "name";
         myMenu.Items.Add("Свойства").Name = "property";
         myMenu.Items.Add("Удалить").Name  = "delete";
         myMenu.Show(pictureBox1, new Point(e.X, e.Y));
         myMenu.Items["name"].Click     += ScopeUser_Name_Click;
         myMenu.Items["property"].Click += ScopeUser_Property_Click;
         myMenu.Items["delete"].Click   += ScopeUser_Delete_Click;
     }
     else if (e.Button == MouseButtons.Left)
     {
         ArrowAdd(this);
     }
 }
コード例 #48
0
        private void customersGrid_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                ContextMenuStrip rcMenu = new System.Windows.Forms.ContextMenuStrip();
                mousePosition = customersGrid.HitTest(e.X, e.Y).RowIndex;

                if (mousePosition >= 0)
                {
                    rcMenu.Items.Add("Cancella").Name = "Cancella";
                    rcMenu.Items.Add("Modifica").Name = "Modifica";
                    rcMenu.Items.Add("Dettagli").Name = "Dettagli";
                }

                rcMenu.Show(customersGrid, new Point(e.X, e.Y));

                rcMenu.ItemClicked += new ToolStripItemClickedEventHandler(rcMenu_Clicked);
            }
        }
コード例 #49
0
        // Sağ tıklaması için
        private void dataGridView1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                ContextMenuStrip myMenu   = new System.Windows.Forms.ContextMenuStrip();
                int position_xy_mouse_row = dataGridView1.HitTest(e.X, e.Y).RowIndex;

                //MessageBox.Show(position_xy_mouse_row.ToString());

                if (position_xy_mouse_row >= 0)
                {
                    // Context Menuye İtem Ekleme
                    myMenu.Items.Add("Delete").Name = "Delete";
                }

                myMenu.Show(dataGridView1, new Point(e.X, e.Y));
                myMenu.ItemClicked += new ToolStripItemClickedEventHandler(myMenu_ItemClicked);
            }
        }
コード例 #50
0
ファイル: Form1.cs プロジェクト: thalukanyomulaudzi/Techno
        void Stock_mouse_click(Object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                ContextMenuStrip myMenu = new System.Windows.Forms.ContextMenuStrip();
                int position_xy__row    = dgvStock.HitTest(e.X, e.Y).RowIndex;
                if (position_xy__row >= 0)
                {
                    myMenu.Items.Add("Maintain").Name  = "Maintain";
                    myMenu.Items.Add("Check In").Name  = "Check In";
                    myMenu.Items.Add("Check Out").Name = "Check Out";
                    myMenu.Items.Add("Take").Name      = "Take";
                    myMenu.Items.Add("Write Off").Name = "Write Off";
                }

                frmAdd_New_Stock_Item myform = new frmAdd_New_Stock_Item();

                myMenu.Show(dgvStock, new Point(e.X, e.Y));
                myMenu.ItemClicked += new ToolStripItemClickedEventHandler(myMenu_ItemClicked);
            }
        }
コード例 #51
0
 private void pokemonListView_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         if (pokemonListView.FocusedItem.Bounds.Contains(e.Location) == true)
         {
             ContextMenuStrip myContextMenuStrip = new ContextMenuStrip();
             myContextMenuStrip.Items.Add("Transfer selected pokémons", null, transferSelectedToolStripMenuItem_Click);
             myContextMenuStrip.Items.Add("Evolve selected pokémons", null, evolveSelectedToolStripMenuItem_Click);
             myContextMenuStrip.Items.Add("Powerup selected pokémons", null, powerupSelectedToolStripMenuItem_Click);
             myContextMenuStrip.Show(pokemonListView, e.Location);
         }
     }
 }
コード例 #52
0
ファイル: frmMain.cs プロジェクト: EricBlack/MagicMongoDBTool
        /// <summary>
        ///     ConnectionList TreeView Node is clicked by mouse
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void trvsrvlst_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Node.ImageIndex != -1)
            {
                statusStripMain.Items[0].Image = GetSystemIcon.MainTreeImage.Images[e.Node.ImageIndex];
            }
            //First , set Every MenuItem to disable
            DisableAllOpr();
            if (e.Node.Tag != null)
            {
                //选中节点的设置
                trvsrvlst.SelectedNode = e.Node;
                String strNodeType = SystemManager.GetTagType(e.Node.Tag.ToString());
                String mongoSvrKey = SystemManager.GetTagData(e.Node.Tag.ToString()).Split("/".ToCharArray())[0];
                _config = SystemManager.ConfigHelperInstance.ConnectionList[mongoSvrKey];
                if (String.IsNullOrEmpty(_config.UserName))
                {
                    lblUserInfo.Text = "UserInfo:Admin";
                }
                else
                {
                    lblUserInfo.Text = "UserInfo:" + _config.UserName;
                }
                if (_config.AuthMode)
                {
                    lblUserInfo.Text += " @AuthMode";
                }
                if (_config.IsReadOnly)
                {
                    lblUserInfo.Text += " [ReadOnly]";
                }
                if (!_config.IsReadOnly)
                {
                    //恢复数据:这个操作可以针对服务器,数据库,数据集,所以可以放在共通
                    RestoreMongoToolStripMenuItem.Enabled = true;
                }
                SystemManager.SelectObjectTag = String.Empty;
                if (SystemManager.SelectObjectTag != null)
                {
                    SystemManager.SelectObjectTag = e.Node.Tag.ToString();
                }
                switch (strNodeType)
                {
                    case MongoDbHelper.CONNECTION_TAG:
                    case MongoDbHelper.CONNECTION_REPLSET_TAG:
                    case MongoDbHelper.CONNECTION_CLUSTER_TAG:
                        //普通连接
                        if (SystemManager.IsUseDefaultLanguage)
                        {
                            statusStripMain.Items[0].Text = "Selected Connection:" + SystemManager.SelectTagData;
                        }
                        else
                        {
                            statusStripMain.Items[0].Text =
                                SystemManager.MStringResource.GetText(StringResource.TextType.Selected_Server) + ":" +
                                SystemManager.SelectTagData;
                        }

                        DisconnectToolStripMenuItem.Enabled = true;
                        ShutDownToolStripMenuItem.Enabled = true;
                        ShutDownToolStripButton.Enabled = true;

                        if (strNodeType == MongoDbHelper.CONNECTION_TAG)
                        {
                            InitReplsetToolStripMenuItem.Enabled = true;
                        }
                        if (strNodeType == MongoDbHelper.CONNECTION_REPLSET_TAG)
                        {
                            ReplicaSetToolStripMenuItem.Enabled = true;
                        }
                        if (strNodeType == MongoDbHelper.CONNECTION_CLUSTER_TAG)
                        {
                            ShardingConfigToolStripMenuItem.Enabled = true;
                        }
                        if (e.Button == MouseButtons.Right)
                        {
                            contextMenuStripMain = new ContextMenuStrip();
                            if (SystemManager.MonoMode)
                            {
                                ToolStripMenuItem t1 = DisconnectToolStripMenuItem.Clone();
                                t1.Click += DisconnectToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t1);

                                ToolStripMenuItem t2 = InitReplsetToolStripMenuItem.Clone();
                                t2.Click += InitReplsetToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t2);

                                ToolStripMenuItem t3 = ReplicaSetToolStripMenuItem.Clone();
                                t3.Click += ReplicaSetToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t3);

                                ToolStripMenuItem t4 = ShardingConfigToolStripMenuItem.Clone();
                                t4.Click += ShardingConfigToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t4);

                                ToolStripMenuItem t5 = ShutDownToolStripMenuItem.Clone();
                                t5.Click += ShutDownToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t5);
                            }
                            else
                            {
                                contextMenuStripMain.Items.Add(DisconnectToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(ShutDownToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(InitReplsetToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(ReplicaSetToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(ShardingConfigToolStripMenuItem.Clone());
                            }
                            e.Node.ContextMenuStrip = contextMenuStripMain;
                            contextMenuStripMain.Show(trvsrvlst.PointToScreen(e.Location));
                        }
                        break;
                    case MongoDbHelper.CONNECTION_EXCEPTION_TAG:
                        SystemManager.SelectObjectTag = e.Node.Tag.ToString();
                        DisconnectToolStripMenuItem.Enabled = true;
                        RestoreMongoToolStripMenuItem.Enabled = false;
                        if (e.Button == MouseButtons.Right)
                        {
                            contextMenuStripMain = new ContextMenuStrip();
                            if (SystemManager.MonoMode)
                            {
                                //悲催MONO不支持
                                ToolStripMenuItem t1 = DisconnectToolStripMenuItem.Clone();
                                t1.Click += DisconnectToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t1);
                            }
                            else
                            {
                                contextMenuStripMain.Items.Add(DisconnectToolStripMenuItem.Clone());
                            }
                            e.Node.ContextMenuStrip = contextMenuStripMain;
                            contextMenuStripMain.Show(trvsrvlst.PointToScreen(e.Location));
                        }
                        statusStripMain.Items[0].Text = "Selected Server[Exception]:" + SystemManager.SelectTagData;
                        break;
                    case MongoDbHelper.SERVER_TAG:
                        SystemManager.SelectObjectTag = e.Node.Tag.ToString();
                        if (SystemManager.IsUseDefaultLanguage)
                        {
                            statusStripMain.Items[0].Text = "Selected Server:" + SystemManager.SelectTagData;
                        }
                        else
                        {
                            statusStripMain.Items[0].Text =
                                SystemManager.MStringResource.GetText(StringResource.TextType.Selected_Server) + ":" +
                                SystemManager.SelectTagData;
                        }
                        //解禁 创建数据库,关闭服务器
                        if (!_config.IsReadOnly)
                        {
                            CreateMongoDBToolStripMenuItem.Enabled = true;
                            AddUserToAdminToolStripMenuItem.Enabled = true;
                            if (_config.ServerRole == ConfigHelper.SvrRoleType.MasterSvr ||
                                _config.ServerRole == ConfigHelper.SvrRoleType.SlaveSvr)
                            {
                                //Master,Slave都可以执行
                                slaveResyncToolStripMenuItem.Enabled = true;
                            }
                        }
                        UserInfoStripMenuItem.Enabled = true;
                        ServerStatusToolStripMenuItem.Enabled = true;
                        ServePropertyToolStripMenuItem.Enabled = true;

                        if (e.Button == MouseButtons.Right)
                        {
                            contextMenuStripMain = new ContextMenuStrip();
                            if (SystemManager.MonoMode)
                            {
                                //悲催MONO不支持
                                ToolStripMenuItem t1 = CreateMongoDBToolStripMenuItem.Clone();
                                t1.Click += CreateMongoDBToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t1);

                                ToolStripMenuItem t2 = AddUserToAdminToolStripMenuItem.Clone();
                                t2.Click += AddUserToAdminToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t2);

                                ToolStripMenuItem t3 = RestoreMongoToolStripMenuItem.Clone();
                                t3.Click += RestoreMongoToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t3);

                                ToolStripMenuItem t6 = slaveResyncToolStripMenuItem.Clone();
                                t6.Click += slaveResyncToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t6);

                                ToolStripMenuItem t9 = ServePropertyToolStripMenuItem.Clone();
                                t9.Click += ServePropertyToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t9);

                                ToolStripMenuItem t10 = ServerStatusToolStripMenuItem.Clone();
                                t10.Click += SvrStatusToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t10);
                            }
                            else
                            {
                                contextMenuStripMain.Items.Add(CreateMongoDBToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(AddUserToAdminToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(AddAdminCustomeRoleStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(UserInfoStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(RestoreMongoToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(slaveResyncToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(ServePropertyToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(ServerStatusToolStripMenuItem.Clone());
                            }
                            e.Node.ContextMenuStrip = contextMenuStripMain;
                            contextMenuStripMain.Show(trvsrvlst.PointToScreen(e.Location));
                        }
                        //PlugIn
                        foreach (ToolStripMenuItem item in plugInToolStripMenuItem.DropDownItems)
                        {
                            if (PlugIn.PlugInList[item.Tag.ToString()].RunLv == PlugBase.PathLv.ConnectionLV)
                            {
                                item.Enabled = true;
                            }
                        }
                        break;
                    case MongoDbHelper.SINGLE_DB_SERVER_TAG:
                        //单数据库模式,禁止所有服务器操作
                        SystemManager.SelectObjectTag = e.Node.Tag.ToString();
                        if (e.Button == MouseButtons.Right)
                        {
                            contextMenuStripMain = new ContextMenuStrip();
                            if (SystemManager.MonoMode)
                            {
                                //悲催MONO不支持
                                ToolStripMenuItem t1 = DisconnectToolStripMenuItem.Clone();
                                t1.Click += DisconnectToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t1);
                                ToolStripMenuItem t2 = ServerStatusToolStripMenuItem.Clone();
                                t2.Click += SvrStatusToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t2);
                            }
                            else
                            {
                                contextMenuStripMain.Items.Add(DisconnectToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(ServerStatusToolStripMenuItem.Clone());
                            }
                            e.Node.ContextMenuStrip = contextMenuStripMain;
                            contextMenuStripMain.Show(trvsrvlst.PointToScreen(e.Location));
                        }
                        statusStripMain.Items[0].Text = "Selected Server[Single Database]:" +
                                                        SystemManager.SelectTagData;
                        break;
                    case MongoDbHelper.DATABASE_TAG:
                    case MongoDbHelper.SINGLE_DATABASE_TAG:
                        SystemManager.SelectObjectTag = e.Node.Tag.ToString();
                        List<String> roles = User.GetCurrentDBRoles();
                        if (SystemManager.IsUseDefaultLanguage)
                        {
                            statusStripMain.Items[0].Text = "Selected DataBase:" + SystemManager.SelectTagData;
                        }
                        else
                        {
                            statusStripMain.Items[0].Text =
                                SystemManager.MStringResource.GetText(StringResource.TextType.Selected_DataBase) + ":" +
                                SystemManager.SelectTagData;
                        }
                        //系统库不允许修改
                        if (!MongoDbHelper.IsSystemDataBase(SystemManager.GetCurrentDataBase().Name))
                        {
                            if (_config.AuthMode)
                            {
                                //根据Roles确定删除数据库/创建数据集等的权限
                                DelMongoDBToolStripMenuItem.Enabled = Common.Security.Action.JudgeRightByBuildInRole(roles,
                                    Common.Security.Action.ActionType.ServerAdministrationActions_dropDatabase);
                                CreateMongoCollectionToolStripMenuItem.Enabled = Common.Security.Action.JudgeRightByBuildInRole(roles,
                                    Common.Security.Action.ActionType.DatabaseManagementActions_createCollection);
                                InitGFSToolStripMenuItem.Enabled = Common.Security.Action.JudgeRightByBuildInRole(roles,
                                    Common.Security.Action.ActionType.Misc_InitGFS);
                                AddUserToolStripMenuItem.Enabled = Common.Security.Action.JudgeRightByBuildInRole(roles,
                                    Common.Security.Action.ActionType.DatabaseManagementActions_createUser);
                                //If a Slave server can repair database @ Master-Slave is not sure ??
                                RepairDBToolStripMenuItem.Enabled = Common.Security.Action.JudgeRightByBuildInRole(roles,
                                    Common.Security.Action.ActionType.ServerAdministrationActions_repairDatabase);
                            }
                            else
                            {
                                DelMongoDBToolStripMenuItem.Enabled = true;
                                CreateMongoCollectionToolStripMenuItem.Enabled = true;
                                InitGFSToolStripMenuItem.Enabled = true;
                                AddUserToolStripMenuItem.Enabled = true;
                                RepairDBToolStripMenuItem.Enabled = true;
                            }
                            EvalJSToolStripMenuItem.Enabled = Common.Security.Action.JudgeRightByBuildInRole(roles,
                                Common.Security.Action.ActionType.Misc_EvalJS);
                        }
                        //备份数据库
                        DumpDatabaseToolStripMenuItem.Enabled = true;
                        ProfillingLevelToolStripMenuItem.Enabled = true;
                        if (strNodeType == MongoDbHelper.SINGLE_DATABASE_TAG)
                        {
                            DelMongoDBToolStripMenuItem.Enabled = false;
                        }
                        DBStatusToolStripMenuItem.Enabled = true;
                        if (e.Button == MouseButtons.Right)
                        {
                            contextMenuStripMain = new ContextMenuStrip();
                            if (SystemManager.MonoMode)
                            {
                                //悲催MONO不支持
                                ToolStripMenuItem t1 = DelMongoDBToolStripMenuItem.Clone();
                                t1.Click += DelMongoDBToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t1);

                                ToolStripMenuItem t2 = CreateMongoCollectionToolStripMenuItem.Clone();
                                t2.Click += CreateMongoCollectionToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t2);

                                ToolStripMenuItem t3 = AddUserToolStripMenuItem.Clone();
                                t3.Click += AddUserToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t3);

                                ToolStripMenuItem t4 = EvalJSToolStripMenuItem.Clone();
                                t4.Click += evalJSToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t4);

                                ToolStripMenuItem t5 = RepairDBToolStripMenuItem.Clone();
                                t5.Click += RepairDBToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t5);


                                ToolStripMenuItem t6 = InitGFSToolStripMenuItem.Clone();
                                t6.Click += InitGFSToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t6);

                                ToolStripMenuItem t7 = DumpDatabaseToolStripMenuItem.Clone();
                                t7.Click += DumpDatabaseToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t7);

                                ToolStripMenuItem t8 = RestoreMongoToolStripMenuItem.Clone();
                                t8.Click += RestoreMongoToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t8);


                                contextMenuStripMain.Items.Add(new ToolStripSeparator());

                                ToolStripMenuItem t10 = ProfillingLevelToolStripMenuItem.Clone();
                                t10.Click += profillingLevelToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t10);

                                ToolStripMenuItem t11 = DBStatusToolStripMenuItem.Clone();
                                t11.Click += DBStatusToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t11);
                            }
                            else
                            {
                                contextMenuStripMain.Items.Add(DelMongoDBToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(CreateMongoCollectionToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(AddUserToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(AddDBCustomeRoleStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(EvalJSToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(RepairDBToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(InitGFSToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(DumpDatabaseToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(RestoreMongoToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(new ToolStripSeparator());
                                contextMenuStripMain.Items.Add(ProfillingLevelToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(DBStatusToolStripMenuItem.Clone());
                            }
                            e.Node.ContextMenuStrip = contextMenuStripMain;
                            contextMenuStripMain.Show(trvsrvlst.PointToScreen(e.Location));
                        }
                        break;
                    case MongoDbHelper.SYSTEM_COLLECTION_LIST_TAG:
                        SystemManager.SelectObjectTag = e.Node.Tag.ToString();
                        statusStripMain.Items[0].Text = "System Collection List ";
                        break;
                    case MongoDbHelper.COLLECTION_LIST_TAG:
                        SystemManager.SelectObjectTag = e.Node.Tag.ToString();
                        statusStripMain.Items[0].Text = "Collection List ";
                        break;
                    case MongoDbHelper.COLLECTION_TAG:
                        if (SystemManager.IsUseDefaultLanguage)
                        {
                            statusStripMain.Items[0].Text = "Selected Collection:" + SystemManager.SelectTagData;
                        }
                        else
                        {
                            statusStripMain.Items[0].Text =
                                SystemManager.MStringResource.GetText(StringResource.TextType.Selected_Collection) + ":" +
                                SystemManager.SelectTagData;
                        }
                        //解禁 删除数据集
                        if (!MongoDbHelper.IsSystemCollection(SystemManager.GetCurrentCollection()))
                        {
                            //系统数据库无法删除!!
                            if (!_config.IsReadOnly)
                            {
                                DelMongoCollectionToolStripMenuItem.Enabled = true;
                                RenameCollectionToolStripMenuItem.Enabled = true;
                            }
                        }
                        if (!_config.IsReadOnly)
                        {
                            ImportCollectionToolStripMenuItem.Enabled = true;
                            CompactToolStripMenuItem.Enabled = true;
                        }
                        if (!MongoDbHelper.IsSystemCollection(SystemManager.GetCurrentCollection()) &&
                            !_config.IsReadOnly)
                        {
                            IndexManageToolStripMenuItem.Enabled = true;
                            ReIndexToolStripMenuItem.Enabled = true;
                        }
                        DumpCollectionToolStripMenuItem.Enabled = true;
                        ExportCollectionToolStripMenuItem.Enabled = true;
                        AggregationToolStripMenuItem.Enabled = true;
                        ViewDataToolStripMenuItem.Enabled = true;
                        CollectionStatusToolStripMenuItem.Enabled = true;
                        ValidateToolStripMenuItem.Enabled = true;
                        ExportToFileToolStripMenuItem.Enabled = true;
                        if (e.Button == MouseButtons.Right)
                        {
                            contextMenuStripMain = new ContextMenuStrip();
                            if (SystemManager.MonoMode)
                            {
                                //悲催MONO不支持
                                ToolStripMenuItem t1 = DelMongoCollectionToolStripMenuItem.Clone();
                                t1.Click += DelMongoCollectionToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t1);

                                ToolStripMenuItem t2 = RenameCollectionToolStripMenuItem.Clone();
                                t2.Click += RenameCollectionToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t2);

                                ToolStripMenuItem t3 = DumpCollectionToolStripMenuItem.Clone();
                                t3.Click += DumpCollectionToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t3);

                                ToolStripMenuItem t4 = RestoreMongoToolStripMenuItem.Clone();
                                t4.Click += RestoreMongoToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t4);

                                ToolStripMenuItem t5 = ImportCollectionToolStripMenuItem.Clone();
                                t5.Click += ImportCollectionToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t5);

                                ToolStripMenuItem t6 = ExportCollectionToolStripMenuItem.Clone();
                                t6.Click += ExportCollectionToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t6);

                                ToolStripMenuItem t7 = CompactToolStripMenuItem.Clone();
                                t7.Click += CompactToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t7);

                                contextMenuStripMain.Items.Add(new ToolStripSeparator());

                                ToolStripMenuItem t8 = ViewDataToolStripMenuItem.Clone();
                                t8.Click += (x, y) => ViewDataObj();
                                contextMenuStripMain.Items.Add(t8);

                                ToolStripMenuItem AggregationMenu = AggregationToolStripMenuItem.Clone();

                                ToolStripMenuItem t9 = countToolStripMenuItem.Clone();
                                t9.Click += countToolStripMenuItem_Click;
                                AggregationMenu.DropDownItems.Add(t9);

                                ToolStripMenuItem t10 = distinctToolStripMenuItem.Clone();
                                t10.Click += distinctToolStripMenuItem_Click;
                                AggregationMenu.DropDownItems.Add(t10);


                                ToolStripMenuItem t11 = groupToolStripMenuItem.Clone();
                                t11.Click += groupToolStripMenuItem_Click;
                                AggregationMenu.DropDownItems.Add(t11);

                                ToolStripMenuItem t12 = mapReduceToolStripMenuItem.Clone();
                                t12.Click += mapReduceToolStripMenuItem_Click;
                                AggregationMenu.DropDownItems.Add(t12);

                                contextMenuStripMain.Items.Add(AggregationMenu);
                                contextMenuStripMain.Items.Add(new ToolStripSeparator());

                                ToolStripMenuItem t13 = IndexManageToolStripMenuItem.Clone();
                                t13.Click += IndexManageToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t13);

                                ToolStripMenuItem t14 = ReIndexToolStripMenuItem.Clone();
                                t14.Click += ReIndexToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t14);

                                contextMenuStripMain.Items.Add(new ToolStripSeparator());

                                ToolStripMenuItem t15 = CollectionStatusToolStripMenuItem.Clone();
                                t15.Click += CollectionStatusToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t15);
                            }
                            else
                            {
                                contextMenuStripMain.Items.Add(DelMongoCollectionToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(RenameCollectionToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(DumpCollectionToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(RestoreMongoToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(ImportCollectionToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(ExportCollectionToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(ExportToFileToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(CompactToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(new ToolStripSeparator());
                                contextMenuStripMain.Items.Add(ViewDataToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(AggregationToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(new ToolStripSeparator());
                                contextMenuStripMain.Items.Add(IndexManageToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(ReIndexToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(new ToolStripSeparator());
                                contextMenuStripMain.Items.Add(CollectionStatusToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(ValidateToolStripMenuItem.Clone());
                            }
                            e.Node.ContextMenuStrip = contextMenuStripMain;
                            contextMenuStripMain.Show(trvsrvlst.PointToScreen(e.Location));
                        }
                        //PlugIn
                        foreach (ToolStripMenuItem item in plugInToolStripMenuItem.DropDownItems)
                        {
                            if (PlugIn.PlugInList[item.Tag.ToString()].RunLv == PlugBase.PathLv.CollectionLV)
                            {
                                item.Enabled = true;
                            }
                        }
                        break;
                    case MongoDbHelper.INDEX_TAG:
                        if (SystemManager.IsUseDefaultLanguage)
                        {
                            statusStripMain.Items[0].Text = "Selected Index:" + SystemManager.SelectTagData;
                        }
                        else
                        {
                            statusStripMain.Items[0].Text =
                                SystemManager.MStringResource.GetText(StringResource.TextType.Selected_Index) + ":" +
                                SystemManager.SelectTagData;
                        }
                        break;
                    case MongoDbHelper.INDEXES_TAG:
                        if (SystemManager.IsUseDefaultLanguage)
                        {
                            statusStripMain.Items[0].Text = "Selected Index:" + SystemManager.SelectTagData;
                        }
                        else
                        {
                            statusStripMain.Items[0].Text =
                                SystemManager.MStringResource.GetText(StringResource.TextType.Selected_Indexes) + ":" +
                                SystemManager.SelectTagData;
                        }
                        break;
                    case MongoDbHelper.USER_LIST_TAG:
                        if (SystemManager.IsUseDefaultLanguage)
                        {
                            statusStripMain.Items[0].Text = "Selected UserList:" + SystemManager.SelectTagData;
                        }
                        else
                        {
                            statusStripMain.Items[0].Text =
                                SystemManager.MStringResource.GetText(StringResource.TextType.Selected_UserList) + ":" +
                                SystemManager.SelectTagData;
                        }
                        ViewDataToolStripMenuItem.Enabled = true;
                        if (e.Button == MouseButtons.Right)
                        {
                            contextMenuStripMain = new ContextMenuStrip();
                            if (SystemManager.MonoMode)
                            {
                                ToolStripMenuItem t8 = ViewDataToolStripMenuItem.Clone();
                                t8.Click += (x, y) => ViewDataObj();
                                contextMenuStripMain.Items.Add(t8);
                            }
                            else
                            {
                                contextMenuStripMain.Items.Add(ViewDataToolStripMenuItem.Clone());
                            }
                            e.Node.ContextMenuStrip = contextMenuStripMain;
                            contextMenuStripMain.Show(trvsrvlst.PointToScreen(e.Location));
                        }
                        break;
                    case MongoDbHelper.GRID_FILE_SYSTEM_TAG:
                        //GridFileSystem
                        SystemManager.SelectObjectTag = e.Node.Tag.ToString();
                        if (SystemManager.IsUseDefaultLanguage)
                        {
                            statusStripMain.Items[0].Text = "Selected GFS:" + SystemManager.SelectTagData;
                        }
                        else
                        {
                            statusStripMain.Items[0].Text =
                                SystemManager.MStringResource.GetText(StringResource.TextType.Selected_GFS) + ":" +
                                SystemManager.SelectTagData;
                        }

                        ViewDataToolStripMenuItem.Enabled = true;
                        if (e.Button == MouseButtons.Right)
                        {
                            contextMenuStripMain = new ContextMenuStrip();
                            if (SystemManager.MonoMode)
                            {
                                ToolStripMenuItem t8 = ViewDataToolStripMenuItem.Clone();
                                t8.Click += (x, y) => ViewDataObj();
                                contextMenuStripMain.Items.Add(t8);
                            }
                            else
                            {
                                contextMenuStripMain.Items.Add(ViewDataToolStripMenuItem.Clone());
                            }
                            e.Node.ContextMenuStrip = contextMenuStripMain;
                            contextMenuStripMain.Show(trvsrvlst.PointToScreen(e.Location));
                        }
                        break;
                    case MongoDbHelper.JAVASCRIPT_TAG:
                        SystemManager.SelectObjectTag = e.Node.Tag.ToString();
                        ViewDataToolStripMenuItem.Enabled = true;
                        if (!_config.IsReadOnly)
                        {
                            creatJavaScriptToolStripMenuItem.Enabled = true;
                        }
                        if (e.Button == MouseButtons.Right)
                        {
                            contextMenuStripMain = new ContextMenuStrip();
                            if (SystemManager.MonoMode)
                            {
                                ToolStripMenuItem t8 = creatJavaScriptToolStripMenuItem.Clone();
                                t8.Click += creatJavaScriptToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t8);
                            }
                            else
                            {
                                contextMenuStripMain.Items.Add(creatJavaScriptToolStripMenuItem.Clone());
                            }
                            e.Node.ContextMenuStrip = contextMenuStripMain;
                            contextMenuStripMain.Show(trvsrvlst.PointToScreen(e.Location));
                        }
                        statusStripMain.Items[0].Text = "Selected collection Javascript";
                        break;
                    case MongoDbHelper.JAVASCRIPT_DOC_TAG:
                        statusStripMain.Items[0].Text = "Selected JavaScript:" + SystemManager.SelectTagData;
                        ViewDataToolStripMenuItem.Enabled = true;
                        dropJavascriptToolStripMenuItem.Enabled = true;

                        if (e.Button == MouseButtons.Right)
                        {
                            contextMenuStripMain = new ContextMenuStrip();
                            if (SystemManager.MonoMode)
                            {
                                ToolStripMenuItem t1 = ViewDataToolStripMenuItem.Clone();
                                t1.Click += (x, y) => ViewDataObj();
                                contextMenuStripMain.Items.Add(t1);
                                ToolStripMenuItem t8 = dropJavascriptToolStripMenuItem.Clone();
                                t8.Click += dropJavascriptToolStripMenuItem_Click;
                                contextMenuStripMain.Items.Add(t8);
                            }
                            else
                            {
                                contextMenuStripMain.Items.Add(ViewDataToolStripMenuItem.Clone());
                                contextMenuStripMain.Items.Add(dropJavascriptToolStripMenuItem.Clone());
                            }
                            e.Node.ContextMenuStrip = contextMenuStripMain;
                            contextMenuStripMain.Show(trvsrvlst.PointToScreen(e.Location));
                        }
                        break;
                    default:
                        statusStripMain.Items[0].Text = "Selected Object:" + e.Node.Text;
                        break;
                }
            }
            else
            {
                statusStripMain.Items[0].Text = "Selected Object:" + e.Node.Text;
            }
            //重新Reset工具栏
            SetToolBarEnabled();
        }
コード例 #53
0
 /// <summary>
 /// Opens the context mouse click.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
 /// <remarks></remarks>
 private void OpenContextMouseClick(object sender, MouseEventArgs e)
 {
     ContextMenuStrip conmen = new ContextMenuStrip();
     ContextMenuCreator(ref conmen);
     conmen.Show(_openContext, new Point(_openContext.Width, 0));
 }
コード例 #54
0
 /// <summary>
 ///     鼠标动作(顶层)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void trvData_MouseClick_Top(object sender, MouseEventArgs e)
 {
     if (IsNeedChangeNode)
     {
         //在节点展开和关闭后,不能使用这个方法来重新设定SelectedNode
         trvData.DatatreeView.SelectedNode = trvData.DatatreeView.GetNodeAt(e.Location);
     }
     IsNeedChangeNode = true;
     if (trvData.DatatreeView.SelectedNode == null)
     {
         return;
     }
     SystemManager.SetCurrentDocument(trvData.DatatreeView.SelectedNode);
     if (trvData.DatatreeView.SelectedNode.Level == 0)
     {
         if (e.Button == MouseButtons.Right)
         {
             contextMenuStripMain = new ContextMenuStrip();
             ///允许删除
             DelSelectRecordToolToolStripMenuItem.Enabled = true;
             contextMenuStripMain.Items.Add(DelSelectRecordToolToolStripMenuItem.Clone());
             ///允许添加
             AddElementToolStripMenuItem.Enabled = true;
             contextMenuStripMain.Items.Add(AddElementToolStripMenuItem.Clone());
             ///允许粘贴
             PasteElementToolStripMenuItem.Enabled = true;
             contextMenuStripMain.Items.Add(PasteElementToolStripMenuItem.Clone());
             trvData.DatatreeView.ContextMenuStrip = contextMenuStripMain;
             contextMenuStripMain.Show(trvData.DatatreeView.PointToScreen(e.Location));
         }
     }
     else
     {
         //非顶层元素
         trvData_MouseClick_NotTop(sender, e);
     }
 }
コード例 #55
0
 /// <summary>
 ///     鼠标动作(非顶层)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void trvData_MouseClick_NotTop(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         contextMenuStripMain = new ContextMenuStrip();
         contextMenuStripMain.Items.Add(AddElementToolStripMenuItem.Clone());
         contextMenuStripMain.Items.Add(ModifyElementToolStripMenuItem.Clone());
         contextMenuStripMain.Items.Add(DropElementToolStripMenuItem.Clone());
         contextMenuStripMain.Items.Add(CopyElementToolStripMenuItem.Clone());
         contextMenuStripMain.Items.Add(CutElementToolStripMenuItem.Clone());
         contextMenuStripMain.Items.Add(PasteElementToolStripMenuItem.Clone());
         trvData.DatatreeView.ContextMenuStrip = contextMenuStripMain;
         contextMenuStripMain.Show(trvData.DatatreeView.PointToScreen(e.Location));
     }
 }
コード例 #56
0
 /// <summary>
 ///     数据列表右键菜单
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected virtual void lstData_MouseClick(object sender, MouseEventArgs e)
 {
     SystemManager.SelectObjectTag = mDataViewInfo.strDBTag;
     if (lstData.SelectedItems.Count > 0)
     {
         if (e.Button == MouseButtons.Right)
         {
             contextMenuStripMain = new ContextMenuStrip();
             contextMenuStripMain.Items.Add(NewDocumentToolStripMenuItem.Clone());
             contextMenuStripMain.Items.Add(OpenDocInEditorToolStripMenuItem.Clone());
             contextMenuStripMain.Items.Add(DelSelectRecordToolToolStripMenuItem.Clone());
             contextMenuStripMain.Show(lstData.PointToScreen(e.Location));
         }
     }
 }
コード例 #57
0
ファイル: Manager.cs プロジェクト: AlexandreBurel/pwiz-mzdb
        void chromatogramListForm_CellClick( object sender, ChromatogramListCellClickEventArgs e )
        {
            if( e.Chromatogram == null || e.Button != MouseButtons.Right )
                return;

            ChromatogramListForm chromatogramListForm = sender as ChromatogramListForm;

            List<GraphItem> selectedGraphItems = new List<GraphItem>();
            Set<int> selectedRows = new Set<int>();
            foreach( DataGridViewCell cell in chromatogramListForm.GridView.SelectedCells )
            {
                if( selectedRows.Insert( cell.RowIndex ).WasInserted )
                    selectedGraphItems.Add( chromatogramListForm.GetChromatogram( cell.RowIndex ) as GraphItem );
            }

            if( selectedRows.Count == 0 )
                chromatogramListForm.GridView[e.ColumnIndex, e.RowIndex].Selected = true;

            ContextMenuStrip menu = new ContextMenuStrip();
            if( CurrentGraphForm != null )
            {
                if( selectedRows.Count == 1 )
                {
                    menu.Items.Add( "Show as Current Graph", null, new EventHandler( graphListForm_showAsCurrentGraph ) );
                    menu.Items.Add( "Overlay on Current Graph", null, new EventHandler( graphListForm_overlayOnCurrentGraph ) );
                    menu.Items.Add( "Stack on Current Graph", null, new EventHandler( graphListForm_stackOnCurrentGraph ) );
                } else
                {
                    menu.Items.Add( "Overlay All on Current Graph", null, new EventHandler( graphListForm_overlayAllOnCurrentGraph ) );
                    menu.Items.Add( "Stack All on Current Graph", null, new EventHandler( graphListForm_showAllAsStackOnCurrentGraph ) );
                }
            }

            if( selectedRows.Count == 1 )
            {
                menu.Items.Add( "Show as New Graph", null, new EventHandler( graphListForm_showAsNewGraph ) );
                menu.Items.Add( "Show Table of Data Points", null, new EventHandler( graphListForm_showTableOfDataPoints ) );
                menu.Items[0].Font = new Font( menu.Items[0].Font, FontStyle.Bold );
                menu.Tag = e.Chromatogram;
            } else
            {
                menu.Items.Add( "Show All as New Graphs", null, new EventHandler( graphListForm_showAllAsNewGraph ) );
                menu.Items.Add( "Overlay All on New Graph", null, new EventHandler( graphListForm_overlayAllOnNewGraph ) );
                menu.Items.Add( "Stack All on New Graph", null, new EventHandler( graphListForm_showAllAsStackOnNewGraph ) );
                menu.Tag = selectedGraphItems;
            }

            menu.Show( Form.MousePosition );
        }
コード例 #58
0
ファイル: QuickTaskMenu.cs プロジェクト: ElectronicWar/ShareX
        public void ShowMenu()
        {
            ContextMenuStrip cms = new ContextMenuStrip()
            {
                Font = new Font("Arial", 10f),
                AutoClose = false
            };

            ToolStripMenuItem tsmiContinue = new ToolStripMenuItem(Resources.QuickTaskMenu_ShowMenu_Continue);
            tsmiContinue.Image = Resources.control;
            tsmiContinue.Click += (sender, e) =>
            {
                cms.Close();
                OnTaskInfoSelected(null);
            };
            cms.Items.Add(tsmiContinue);

            cms.Items.Add(new ToolStripSeparator());

            if (Program.Settings != null && Program.Settings.QuickTaskPresets != null && Program.Settings.QuickTaskPresets.Count > 0)
            {
                foreach (QuickTaskInfo taskInfo in Program.Settings.QuickTaskPresets)
                {
                    if (taskInfo.IsValid)
                    {
                        ToolStripMenuItem tsmi = new ToolStripMenuItem { Text = taskInfo.ToString().Replace("&", "&&"), Tag = taskInfo };
                        tsmi.Image = FindSuitableIcon(taskInfo);
                        tsmi.Click += (sender, e) =>
                        {
                            QuickTaskInfo selectedTaskInfo = ((ToolStripMenuItem)sender).Tag as QuickTaskInfo;
                            cms.Close();
                            OnTaskInfoSelected(selectedTaskInfo);
                        };
                        cms.Items.Add(tsmi);
                    }
                    else
                    {
                        cms.Items.Add(new ToolStripSeparator());
                    }
                }

                cms.Items[0].Select();

                cms.Items.Add(new ToolStripSeparator());
            }

            ToolStripMenuItem tsmiEdit = new ToolStripMenuItem(Resources.QuickTaskMenu_ShowMenu_Edit_this_menu___);
            tsmiEdit.Image = Resources.pencil;
            tsmiEdit.Click += (sender, e) =>
            {
                cms.Close();
                new QuickTaskMenuEditorForm().ShowDialog();
            };
            cms.Items.Add(tsmiEdit);

            cms.Items.Add(new ToolStripSeparator());

            ToolStripMenuItem tsmiCancel = new ToolStripMenuItem(Resources.QuickTaskMenu_ShowMenu_Cancel);
            tsmiCancel.Image = Resources.cross;
            tsmiCancel.Click += (sender, e) => cms.Close();
            cms.Items.Add(tsmiCancel);

            Point cursorPosition = CaptureHelpers.GetCursorPosition();
            cursorPosition.Offset(-10, -10);
            cms.Show(cursorPosition);
        }
コード例 #59
0
        private void QuickBtn_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right || sender is Button)
            {
                LanguageInfo info = Program.LanguageManager.Translation;
                var mnu = new ContextMenuStrip();
               
                var mnuSingle = new ToolStripMenuItem("Single") { Name = "Single" };
                var mnuMatch = new ToolStripMenuItem("Match") { Name = "Match" };
                var mnuTag = new ToolStripMenuItem("Tag") { Name = "Tag" };

                mnuSingle.Click += QuickHostItem_Click;
                mnuMatch.Click += QuickHostItem_Click;
                mnuTag.Click += QuickHostItem_Click;

                mnu.Items.AddRange(new ToolStripItem[] { mnuSingle, mnuMatch, mnuTag });

                mnu.DefaultDropDownDirection = ToolStripDropDownDirection.BelowRight;
                mnu.Show((Button)sender, new Point(0, 0 - mnu.Height));
            }
        }
コード例 #60
0
ファイル: FormMain.cs プロジェクト: risetech/manology
        void dgv_MouseClick(object sender, MouseEventArgs e)
        {
            var dgv = sender as DataGridView;
            if (e.Button == MouseButtons.Right) // если правой кнопкой
            {
                _dgvContextClick = dgv;
                DataGridView.HitTestInfo hitTestInfo = dgv.HitTest(e.X, e.Y);
                if (hitTestInfo.Type == DataGridViewHitTestType.Cell)
                {
                    var rowIdx = hitTestInfo.RowIndex;
                    var row = dgv.Rows[rowIdx];
                    var wordStem = row.Cells["Stem"].Value;
                    dgv.ClearSelection();
                    row.Selected = true;

                    ContextMenuStrip cm = new ContextMenuStrip();

                    cm.Items.Add(WordStatusText.GetText(WordStatus.WordNotInTheme), null, DeleteWord);
                    cm.Items.Add(WordStatusText.GetText(WordStatus.WordAreIgnored), null, IgnoreWord);
                    cm.Items.Add(WordStatusText.GetText(WordStatus.WordInTheme), null, AddWord);
                    cm.Items.Add(WordStatusText.GetText(WordStatus.WordInThemeLexicalized), null, LexicalizedWord);

                    var status = _tc.GetWordStatus(CurrentTheme, CurrentWord);
                    foreach (var item in cm.Items.Cast<ToolStripItem>())
                        item.Click += OnChangeStatus;
                    foreach (var item in cm.Items.Cast<ToolStripItem>().Where(i => i.Text == WordStatusText.GetText(status)))
                        item.BackColor = Color.Aqua;
                    cm.Show(dgv, new Point(e.X, e.Y));
                }
            }
        }