private void OnTabControlMouseDown(object sender, MouseEventArgs e) { var point = new Point(e.X, e.Y); var hi = _tabControl.CalcHitInfo(point); if (hi.Page is TTabPage) { _movedPage = hi.Page; _point = point; } else { _movedPage = null; _point = Point.Empty; } }
private void tcRequerimientos_MouseUp(object sender, MouseEventArgs e) { XtraTabControl xtc = sender as XtraTabControl; Point pos = new Point(e.X, e.Y); if (xtc != null) { DevExpress.XtraTab.ViewInfo.XtraTabHitInfo xthi = xtc.CalcHitInfo(pos); //MessageBox.Show(tp + " is clicked!", "xtraTabControl1_MouseUp"); if (xthi != null && xthi.Page.Name == "tpEstadoAprobacion") { if (VwRequerimientoSel != null) { string whereReq = string.Format("iddocumentomov = {0} and idtipodocmov = {1}", VwRequerimientoSel.Idrequerimiento, VwRequerimientoSel.Idtipodocmov); gvHistorialAproReq.BeginUpdate(); gcHistorialAproReq.DataSource = Service.GetAllVwDocumentoaprobacion(whereReq, "fechaaprobacion desc"); gvHistorialAproReq.EndDataUpdate(); gvHistorialAproReq.BestFitColumns(true); } else { gcHistorialAproReq.DataSource = null; } } } }
private void xtraTabControl1_MouseUp(object sender, MouseEventArgs e) { try { progressPanel1.Visible = true; this.Cursor = Cursors.WaitCursor; XtraTabControl xtc = sender as XtraTabControl; Point pos = new Point(e.X, e.Y); DevExpress.XtraTab.ViewInfo.XtraTabHitInfo xthi = xtc.CalcHitInfo(pos); string tp = xthi.Page.Name; // MessageBox.Show(tp + " is clicked!", "xtraTabControl1_MouseUp"); switch (tp) { case "Cutting": BindingData("001", line, Mline); break; case "Nosew": BindingData("002", line, Mline); break; case "HF": BindingData("003", line, Mline); break; case "Stitching": BindingData("004", line, Mline); break; case "Stockfit": BindingData("005", line, Mline); break; case "Assembly": BindingData("006", line, Mline); break; default: break; } gridControl1.Show(); xthi.Page.Controls.Add(gridControl1); gridControl1.Dock = DockStyle.Fill; this.Cursor = Cursors.Default; progressPanel1.Visible = false; } catch (Exception ex) { this.Cursor = Cursors.Default; progressPanel1.Visible = false; } }
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); } } }
/// <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 { } } }
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; } }
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; } }