/// <summary> /// Tabs_MouseUp - Handle mouse right-click operations /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Tabs_MouseUp(object sender, MouseEventArgs e) { Point mousePosition = Control.MousePosition; if (e.Button == MouseButtons.Right) { XtraTabHitInfo hitInfo = Tabs.CalcHitInfo(new Point(e.X, e.Y)); if (hitInfo.HitTest == XtraTabHitTest.PageHeader) { XtraTabPage tp = hitInfo.Page; string tabName = (tp.Tag != null) ? tp.Tag.ToString() : ""; if (tabName == "AddNewTab") { return; } else // show the ResultsPage menu { int x = Cursor.Position.X; int y = Cursor.Position.Y; Point p = new Point(x, y); p = this.PointToClient(p); PageContextMenu.Show(this, p); } } } }
private void OnContentEditorTabMouseDown(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } _menuHitInfo = xtraTabControlContentEditors.CalcHitInfo(new Point(e.X, e.Y)); if (_menuHitInfo.HitTest != XtraTabHitTest.PageHeader) { return; } contextMenuStrip.Show((Control)sender, e.Location); }
private void OnXtraTabControlDoubleClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left && e.Clicks == 2) { XtraTabControl tabControl = sender as XtraTabControl; XtraTabHitInfo hitInfo = tabControl.CalcHitInfo(e.Location); XtraTabPage tabPage = tabControl.SelectedTabPage; if (hitInfo.HitTest == XtraTabHitTest.PageHeader) { SetUpRenameEditor(tabPage); } } }
private void OnTabControlMouseDown(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } _menuHitInfo = xtraTabControl.CalcHitInfo(new Point(e.X, e.Y)); if (!(_menuHitInfo.Page is ProductItemControl && _menuHitInfo.HitTest == XtraTabHitTest.PageHeader)) { return; } contextMenuStrip.Show((Control)sender, e.Location); }
/// <summary> /// Handle rearranging of tab order for QueryTables /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Tabs_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { XtraTabControl c = sender as XtraTabControl; TabDragPoint = new Point(e.X, e.Y); XtraTabHitInfo hi = c.CalcHitInfo(TabDragPoint); if (hi.Page == null || c.TabPages.IndexOf(hi.Page) == 0) // page other than first (criteria) page must be selected { TabDragPoint = Point.Empty; hi.Page = null; } TabDragPage = hi.Page; LastSwappedPage = null; return; }
private void Tabs_DragOver(object sender, System.Windows.Forms.DragEventArgs e) { XtraTabControl c = sender as XtraTabControl; if (c == null) { return; } XtraTabHitInfo hi = c.CalcHitInfo(c.PointToClient(new Point(e.X, e.Y))); if (hi.Page != null) { if (hi.Page != TabDragPage && hi.Page != LastSwappedPage) // move it { int hpi = c.TabPages.IndexOf(hi.Page); int dpi = c.TabPages.IndexOf(TabDragPage); if (hpi < dpi) // moving left { c.TabPages.Move(hpi, TabDragPage); } else // moving right { c.TabPages.Move(hpi + 1, TabDragPage); } Document doc = DocumentList[dpi]; // move the query DocumentList.RemoveAt(dpi); if (hpi < 0 || hpi > DocumentList.Count) { throw new DataException("DocumentList.Insert out of range"); } DocumentList.Insert(hpi, doc); SelectQuery(hpi); } LastSwappedPage = hi.Page; e.Effect = DragDropEffects.Move; } else { e.Effect = DragDropEffects.None; } }
////////////////////////////////////////////////////////////////////////////////// ///////////////// Handle rearranging of tab order for Queries //////////////////// ////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Handle rearranging of tab order for Queries /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Tabs_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { XtraTabControl c = sender as XtraTabControl; TabDragPoint = new Point(e.X, e.Y); XtraTabHitInfo hi = c.CalcHitInfo(TabDragPoint); if (hi.Page == null) { TabDragPoint = Point.Empty; hi.Page = null; } TabDragPage = hi.Page; LastSwappedPage = null; return; }
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 { } } }
//////////////////////////////////////////////// ///////////////// Query Menu //////////////////// //////////////////////////////////////////////// /// <summary> /// Display query command menu on a rt-click on the tab header for a query /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Tabs_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { XtraTabHitInfo hitInfo = Tabs.CalcHitInfo(Tabs.PointToClient(Control.MousePosition)); if (hitInfo.HitTest == XtraTabHitTest.PageHeader) { XtraTabPage tp = hitInfo.Page; string tabName = (tp.Tag != null) ? tp.Tag.ToString() : ""; int x = Cursor.Position.X; int y = Cursor.Position.Y; Point p = new Point(x, y); p = this.PointToClient(p); QueryContextMenu.Show(this, p); } } }
private void xtraTabControl1_MouseUp(object sender, MouseEventArgs e) { XtraTabHitInfo hitInfo = (sender as XtraTabControl).CalcHitInfo(e.Location); if (hitInfo.HitTest == XtraTabHitTest.PageHeader) { if (dragWindow != null) { dragPage.Controls.Add(dragWindow.ClonedPage.Controls[0]); dragWindow.Close(); } } else { FinalizeDragWindow(); } dragPage = null; dragWindow = null; }
private void Tabs_DragOver(object sender, System.Windows.Forms.DragEventArgs e) { XtraTabControl c = sender as XtraTabControl; if (c == null) { return; } XtraTabHitInfo hi = c.CalcHitInfo(c.PointToClient(new Point(e.X, e.Y))); if (hi.Page != null && c.TabPages.IndexOf(hi.Page) != 0) { if (hi.Page != TabDragPage && hi.Page != LastSwappedPage) // move it { int hpi = c.TabPages.IndexOf(hi.Page); int dpi = c.TabPages.IndexOf(TabDragPage); if (hpi < dpi) // moving left { c.TabPages.Move(hpi, TabDragPage); } else // moving right { c.TabPages.Move(hpi + 1, TabDragPage); } hpi--; // adjust for criteria tab dpi--; QueryTable qt = Query.Tables[dpi]; // move the query table Query.RemoveQueryTableAt(dpi); Query.InsertQueryTable(hpi, qt); } LastSwappedPage = hi.Page; e.Effect = DragDropEffects.Move; } else { e.Effect = DragDropEffects.None; } }
/// <summary> /// Show menu for table /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Tabs_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { XtraTabHitInfo hitInfo = Tabs.CalcHitInfo(Tabs.PointToClient(Control.MousePosition)); if (hitInfo.HitTest == XtraTabHitTest.PageHeader) { XtraTabPage tp = hitInfo.Page; if (ShowCriteriaTab && tp == Tabs.TabPages[0]) { return; // no menu if criteria tab } int x = Cursor.Position.X; int y = Cursor.Position.Y; Point p = new Point(x, y); p = this.PointToClient(p); TableControlPrototype.QbTableLabelContextMenu.Show(this, p); } } }
private void ShowTabPageContextMenu(object sender, Point position) { object menu = cmsRightButtonClick; if (menu == null) { return; } XtraTabControl tabCtrl = sender as XtraTabControl; Point pt = MousePosition; XtraTabHitInfo info = tabCtrl.CalcHitInfo(tabCtrl.PointToClient(pt)); ContextMenuStrip contextMenuStrip = menu as ContextMenuStrip; if (contextMenuStrip != null && info.HitTest == XtraTabHitTest.PageHeader) { tabCtrl.SelectedTabPage = info.Page; contextMenuStrip.Show(sender as Control, position); return; } }
private void onTabControlMouseDown(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } XtraTabHitInfo hi = importerTabControl.CalcHitInfo(e.Location); if (hi.HitTest != XtraTabHitTest.PageHeader) { return; } var contextMenu = new DXPopupMenu(); contextMenu.Items.Clear(); contextMenu.Items.Add(new DXMenuItem(Captions.Importer.CloseAllTabsButThis, onCloseAllButThisTab)); contextMenu.Items.Add(new DXMenuItem(Captions.Importer.CloseAllTabsToTheRight, onCloseAllTabsToTheRight)); contextMenu.Items.Add(new DXMenuItem(Captions.Importer.ResetAllTabs, onReopenAllSheets)); contextMenu.ShowPopup(importerTabControl, e.Location); _contextMenuSelectedTab = hi.Page.Text; }
private void xtraTabControl_MouseDown(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) return; _menuHitInfo = xtraTabControl.CalcHitInfo(new Point(e.X, e.Y)); if (_menuHitInfo.HitTest != XtraTabHitTest.PageHeader) return; contextMenuStripPageProperties.Show((Control)sender, e.Location); }