Пример #1
0
        private void tabControl1_MouseClick(object sender, MouseEventArgs e)
        {
            try {
                MouseEventArgs me = (MouseEventArgs)e;
                if (!IsSelectedCategoryAllCategory && me.Button == MouseButtons.Right)
                {
                    MenuItem mi;
                    mi        = new MenuItem("Delete Category: " + tabControl1.SelectedTab.Text);
                    mi.Click += new EventHandler(mi_Delete_Click);

                    var TabRightClickMenu = new System.Windows.Forms.ContextMenu(new MenuItem[] { mi });
                    TabRightClickMenu.GetContextMenu().Show(this, new Point(me.X + tabControl1.Location.X, me.Y + tabControl1.Location.Y));
                }
            } catch (InvalidCastException) {
                // was apparently not a mouse click!
            }
        }
Пример #2
0
        private void tabControl1_MouseClick( object sender, MouseEventArgs e )
        {
            try {
                MouseEventArgs me = (MouseEventArgs)e;
                if ( !IsSelectedCategoryAllCategory && me.Button == MouseButtons.Right ) {
                    MenuItem mi;
                    mi = new MenuItem( "Delete Category: " + tabControl1.SelectedTab.Text );
                    mi.Click += new EventHandler( mi_Delete_Click );

                    var TabRightClickMenu = new System.Windows.Forms.ContextMenu( new MenuItem[] { mi } );
                    TabRightClickMenu.GetContextMenu().Show( this, new Point( me.X + tabControl1.Location.X, me.Y + tabControl1.Location.Y ) );
                }
            } catch ( InvalidCastException ) {
                // was apparently not a mouse click!
            }
        }