Beispiel #1
0
 private void MenuTabControl_MouseClick(object sender, MouseEventArgs e)
 {
     if (((e.Button == MouseButtons.Right) && ((MenuTabControl.SelectedTab == TabPageTeacherProfile) ||
                                               (MenuTabControl.SelectedTab == TabPageRatePage))))
     {
         if (MenuTabControl.GetTabRect(MenuTabControl.SelectedIndex).Contains(e.Location))
         {
             TabContextMenu.Show(MousePosition);
         }
     }
 }
Beispiel #2
0
 private void Tabs_MouseUp(object sender, MouseEventArgs e)
 {
     try
     {
         if (e.Button == MouseButtons.Right)
         {
             this.TabContextMenu.Show(this.Tabs, e.Location);
             TabContextMenu.Show(Cursor.Position);
         }
     }
     catch { }
 }
Beispiel #3
0
        private void tcMain_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                XtraTabControl tabCtrl = sender as XtraTabControl;
                Point          pt      = MousePosition;
                XtraTabHitInfo info    = tabCtrl.CalcHitInfo(tabCtrl.PointToClient(pt));
                if (info.HitTest == XtraTabHitTest.PageHeader)
                {
                    //contextPage = info.Page;

                    TabContextMenu.Show(pt);
                }
                else
                {
                }
            }
        }
        protected override void OnMouseClick(MouseEventArgs e)
        {
            if (_painter.GetNewTabPath().HitTest(e.Location))
            {
                if (e.Button == MouseButtons.Left)
                {
                    OnNewTabClick(EventArgs.Empty);
                    return;
                }
                else if (e.Button == MouseButtons.Right &&
                         NewTabContextMenu != null)
                {
                    NewTabContextMenu.Show(this, e.Location);
                    return;
                }
            }

            if (this.OptionsMenu != null &&
                e.Button == MouseButtons.Left)
            {
                PointPath optionsPath = _painter.GetOptionsPath();
                if (optionsPath.HitTest(e.Location))
                {
                    OptionsMenu.Show(this, _painter.OptionsMenuLocation);
                    return;
                }
            }

            if (e.Button == MouseButtons.Left)
            {
                Tab closeTab = this.GetTabCloseFromPoint(e.Location);
                if (closeTab != null)
                {
                    ClosingTab = true;
                    this.Tabs.Remove(closeTab);
                    OnTabClosed(new TabClosedEventArgs(closeTab));
                    ClosingTab = false;
                    return;
                }
            }

            if (e.Button != MouseButtons.Left)
            {
                Tab t = GetTabFromPoint(e.Location);
                if (t != null)
                {
                    if (e.Button == MouseButtons.Middle &&
                        this.CloseTabOnMiddleClick)
                    {
                        ClosingTab = true;
                        this.Tabs.Remove(t);
                        OnTabClosed(new TabClosedEventArgs(t));
                        ClosingTab = false;
                        return;
                    }
                    else if (e.Button == MouseButtons.Right &&
                             TabContextMenu != null)
                    {
                        SelectedIndex = Tabs.IndexOf(t);
                        TabContextMenu.Show(this, e.Location);
                        return;
                    }
                    else
                    {
                        SelectedIndex = Tabs.IndexOf(t);
                        OnTabClick(new TabClickEventArgs(t, e));
                        return;
                    }
                }
            }

            base.OnMouseClick(e);
        }