/// <summary> /// 添加双击页签时,关闭页签事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void xtraTabbedMdiManager1_MouseDown(object sender, MouseEventArgs e) { XtraMdiTabPage curPage = (sender as XtraTabbedMdiManager).SelectedPage; if (e.Button == MouseButtons.Left) { DateTime dt = DateTime.Now; TimeSpan span = dt.Subtract(m_LastClick); if (span.TotalMilliseconds < 300) //如果两次点击的时间间隔小于300毫秒,则认为是双击 { if (this.MdiChildren.Length > 1) { // 限制只有在同一个页签上双击才能关闭.(规避两个页签切换时点太快导致意外关闭页签) if (curPage.Equals(m_lastPage)) { //if (this.ActiveMdiChild != m_MapForm) //{ this.ActiveMdiChild.Close(); //} } } m_LastClick = dt.AddMinutes(-1); } else { m_LastClick = dt; m_lastPage = curPage; } } }
void UpdateMdiPictureFormPreview(XtraMdiTabPage page, Image img) { if (page == null) { return; } Image preview = null; const int previewHeight = 32; const int previewWidthMax = 64; //int previewHeight = this.imageList3.ImageSize.Height; if (img != null && img.Height > 0 && previewHeight > 0) { int previewWidth = previewHeight * img.Width / img.Height; if (previewWidth > 0) { if (previewWidth > previewWidthMax) { previewWidth = previewWidthMax; } preview = new Bitmap(img, previewWidth, previewHeight); } } page.Image = preview; }
/// <summary> /// 双击关当前激活的Tab页 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void XtMMTabs_MouseDown(object sender, MouseEventArgs e) { //当前tab页 var curPage = (sender as XtraTabbedMdiManager).SelectedPage; if (e.Button == MouseButtons.Left) { var dt = DateTime.Now; //获取两次时间间隔的时间差 var span = dt.Subtract(m_LastClick); //两次单击时间间隔比较小,则认为是双击 if (span.TotalMilliseconds < 300) { //Tab大于1页才能关闭,默认首页不能关闭。 if (MdiChildren.Length > 1) { if (curPage.Equals(m_LastPage)) { ActiveMdiChild.Close(); } } m_LastClick = dt.AddMinutes(-1); } else { m_LastClick = dt; m_LastPage = curPage; } } }
private void tmrDashboard_Tick(object sender, EventArgs e) { if (!dashboardTimerCalisti) { if (Genel.AktifKullanici_DashboardOtomatikYenilensinMi == false || Genel.AktifKullanici_DashboardID <= 0) { tmrDashboard.Enabled = false; return; } if (Convert.ToInt32(Genel.AktifKullanici_DashboardYenilemeSuresi) > 0) { tmrDashboard.Interval = Genel.AktifKullanici_DashboardYenilemeSuresi * 60000; } //F_EvraklarDashboardGoster frmdashboardgoster = new F_EvraklarDashboardGoster(Genel.AktifKullanici_DashboardID, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null); DashboardForm frm = new DashboardForm(Genel.AktifKullanici_DashboardID); //Genel.AktifKullanici_DashboardID if (MDIFormAcikMi(frm)) { XtraMdiTabPage page = FindPageByText(frm.Text); page.MdiChild.Close(); } frm.MdiParent = this; frm.Show(); dashboardTimerCalisti = true; } }
private void button1_Click(object sender, EventArgs e) { if (this.PCschematic.Visible) { this.PCschematic.Hide(); if (this.toggleSwitch1.IsOn) { this.toggleSwitch1.IsOn = false; } } this.HidePages(); XtraMdiTabPage page = (from t in this.xtraTabbedMdiManager1.Pages.Cast <XtraMdiTabPage>() where t.MdiChild.GetType() == typeof(FrmSetFault) select t).SingleOrDefault <XtraMdiTabPage>(); if (page != null) { page.MdiChild.Show(); ((FrmSetFault)page.MdiChild).BindData(); } else { FrmSetFault fault = new FrmSetFault(); PaidComm.SetFaults += new System.Action <Socket, byte[], int, int, int>(fault.SetFaultEvents); PaidComm.SetCheckEvent += new Action <int, int, int, int>(fault.SetCheckEvent); fault.MdiParent = this; fault.Show(); } }
private void MdiManager_MouseDown(object sender, MouseEventArgs e) { if (LastClickPoint.X == e.X && LastClickPoint.Y == e.Y) { int _usedTime = Environment.TickCount - LastClickTime; if (_usedTime < MouseDoubleClickTime) { int i = 0; BaseTabHitInfo _info = this.MdiManager.CalcHitInfo(new Point(e.X, e.Y)); if (_info.Page != null) { XtraMdiTabPage _page = _info.Page as XtraMdiTabPage; _page.MdiChild.Close(); } _usedTime = 0; } else { _usedTime = Environment.TickCount; } } else { LastClickPoint = new Point(e.X, e.Y); LastClickTime = Environment.TickCount; } }
protected override XtraMdiTabPage CreateNewPage(Form child) { XtraMdiTabPage createdPage = base.CreateNewPage(child); if (!useDefaultImageSize && createdPage.Image != null) { if (PageImageSize.IsEmpty || createdPage.Image.Size == PageImageSize) { return(createdPage); } Bitmap scaledImage = new Bitmap(PageImageSize.Width, PageImageSize.Height); scaledImage.SetResolution(createdPage.Image.HorizontalResolution, createdPage.Image.VerticalResolution); using (Graphics gr = Graphics.FromImage(scaledImage)) { gr.Clear(Color.Transparent); Rectangle dstRect = new Rectangle(0, 0, PageImageSize.Width, pageImageSize.Height); Rectangle srcRect = new Rectangle(0, 0, createdPage.Image.Width, createdPage.Image.Height); gr.DrawImage(createdPage.Image, dstRect, srcRect, GraphicsUnit.Pixel); } createdPage.Image = scaledImage; } return(createdPage); }
private void navBarItem2_LinkClicked(object sender, NavBarLinkEventArgs e) { if (ClientSystemInfo.ModuleId == 0) { MessageBox.Show("当前未连接任何系统模块,无法操作"); return; } if (!CheckInfo.PcCheckState) { MessageBox.Show("现在不处于答题考核状态,无法答题"); return; } this.panelControl6.Height = this.navBarControl1.Height * 4 / 5; this.panelControl6.Visible = true; XtraMdiTabPage xtraMdiTabPage = (from XtraMdiTabPage t in this.xtraTabbedMdiManager1.Pages where t.MdiChild.GetType() == typeof(FrmCheck) select t).SingleOrDefault <XtraMdiTabPage>(); if (xtraMdiTabPage != null) { this.xtraTabbedMdiManager1.Pages.Clear(); this.xtraTabbedMdiManager1.Pages.Add(xtraMdiTabPage); xtraMdiTabPage.MdiChild.Show(); return; } this.xtraTabbedMdiManager1.Pages.Clear(); new FrmCheck(this.time) { MdiParent = this }.Show(); }
private void navBarItem8_LinkClicked(object sender, NavBarLinkEventArgs e) { if (ClientSystemInfo.ModuleId != 0) { XtraMdiTabPage xtraMdiTabPage = (from XtraMdiTabPage t in this.xtraTabbedMdiManager1.Pages where t.MdiChild.GetType() == typeof(FrmCheck) select t).SingleOrDefault <XtraMdiTabPage>(); if (xtraMdiTabPage != null) { this.xtraTabbedMdiManager1.Pages.Clear(); this.xtraTabbedMdiManager1.Pages.Add(xtraMdiTabPage); xtraMdiTabPage.MdiChild.Hide(); } else { this.xtraTabbedMdiManager1.Pages.Clear(); } string text = this.dt.Select(" id=" + ClientSystemInfo.ModuleId).First <DataRow>()["modulename"].ToString(); FrmModuleInfo frmModuleInfo = new FrmModuleInfo(); frmModuleInfo.Text = text; this.panelControl6.Hide(); frmModuleInfo.MdiParent = this; frmModuleInfo.Show(); return; } MessageBox.Show("当前未连接任何系统模块,无法操作"); }
private void xtraTabbedMdiManager_SelectedPageChanged(object sender, EventArgs e) { XtraMdiTabPage page = tabbedMdiManager.SelectedPage; if (page != null) { page.Image = page.MdiChild.Icon.ToBitmap(); } }
protected Image GetMdiTabPageImage(XtraMdiTabPage page) { if (page.Image != null) { return(page.Image); } return(ImageCollection.GetImageListImage(page.TabControl.Images, page.ImageIndex)); }
private void popMenuCloseCurrent_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { XtraMdiTabPage page = xtraTabbedMdiManager1.SelectedPage; if (page != null && page.MdiChild != null) { page.MdiChild.Close(); } }
//关闭右边 private void barCloseRight_ItemClick(object sender, ItemClickEventArgs e) { XtraMdiTabPage xmp = this.myMdi.SelectedPage; while (this.myMdi.Pages[this.myMdi.Pages.Count - 1] != xmp) { this.myMdi.Pages[this.myMdi.Pages.Count - 1].MdiChild.Close(); } }
protected virtual DXMenuItem CreateMenuItem(XtraMdiTabPage page) { DXMenuItem menuItem = new DXMenuItem(); menuItem.Caption = page.Text; menuItem.Image = GetMdiTabPageImage(page); menuItem.Tag = page.MdiChild; return(menuItem); }
private void mdiManager1_PageRemoved(object sender, MdiTabPageEventArgs e) { XtraMdiTabPage page = e.Page; if (page != null) { //if (page.MdiChild.Tag.ToString() == "main") return; FormList.Remove(page.MdiChild.Tag.ToString()); } }
private void barButtonItem18_ItemClick(object sender, ItemClickEventArgs e) { if (!Class_MyInfo.UseTypeValue.Equals("R005")) { Class_PublicMethod class_PublicMethod = new Class_PublicMethod(); Form_WindowSelect form_WindowSelect = new Form_WindowSelect(); form_WindowSelect.OperateType = "删除"; if (form_WindowSelect.ShowDialog() == DialogResult.OK) { if (class_PublicMethod.DeleteXml(form_WindowSelect.PageKey, form_WindowSelect.PageType)) { if (IsTabbedMdi) { XtraMdiTabPage xtraMdiTabPage = null; foreach (XtraMdiTabPage xtra in xtraTabbedMdiManager1.Pages) { if ((xtra.MdiChild.Tag as Class_WindowType).XmlFileName == form_WindowSelect.PageKey) { xtraMdiTabPage = xtra; } } if (xtraMdiTabPage != null) { xtraMdiTabPage.MdiChild.Close(); } } else { Form form = null; foreach (Form item in this.MdiChildren) { if ((item.Tag as Class_WindowType).XmlFileName == form_WindowSelect.PageKey) { form = item; } } if (form != null) { form.Close(); } } displayAlertMessage("温馨", "指定窗体已删除成功!", null, 3); } else { displayAlertMessage("温馨", "指定窗体删除失败!", null, 3); } } form_WindowSelect.Dispose(); } else { MessageBox.Show("前端开发者没有删除权限!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } }
void OnMdiChildFormClosing(object sender, FormClosingEventArgs e) { XtraMdiTabPage page = xtraTabbedMdiManager1.Pages[sender as Form]; int index = xtraTabbedMdiManager1.Pages.IndexOf(page); index--; if (index >= 0) { xtraTabbedMdiManager1.SelectedPage = xtraTabbedMdiManager1.Pages[index]; } }
private void biClose_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { XtraMdiTabPage page = mdiManager1.SelectedPage; if (page != null) { if (page.MdiChild.Tag.ToString() == "main") { return; } page.MdiChild.Close(); FormList.Remove(page.MdiChild.Tag.ToString()); } }
private void mdiManager1_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { XtraMdiTabPage page = mdiManager1.CalcHitInfo(new Point(e.X, e.Y)).Page as XtraMdiTabPage; if (page != null) { if (mdiManager1.SelectedPage != page) { mdiManager1.SelectedPage = page; } pmTabbed.ShowPopup(Control.MousePosition); } } }
private void xtraTabbedMdiManager_SelectedPageChanged(object sender, EventArgs e) { XtraMdiTabPage page = tabbedMdiManager.SelectedPage; if (page != null) { page.Image = page.MdiChild.Icon.ToBitmap(); XtraWindowSmartPartInfo smartPartInfo = (XtraWindowSmartPartInfo)page.MdiChild.Tag; if (smartPartInfo != null) { page.Tooltip = smartPartInfo.Description; } } }
private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Form AcikFormlar = Application.OpenForms["DashboardForm"]; if (AcikFormlar != null) { XtraMdiTabPage page = FindPageByText("Dashboard"); xtraTabbedMdiManager1.SelectedPage = page; ribbonControl1.HideApplicationButtonContentControl(); return; } DashboardForm frm = new DashboardForm(4); frm.MdiParent = this; frm.Show(); }
/// <summary> /// 初始化系统首页 /// </summary> private void InitHomeForm() { try { HomeForm homeForm = new HomeForm(); homeForm.MdiParent = this; homeForm.ShowIcon = true; homeForm.Show(); XtraMdiTabPage page = this.xtraTabbedMdiManager.Pages[homeForm]; page.Image = Image.FromFile(ConstString.Images16 + "upload_for_windows.png"); } catch (Exception ex) { MsgShowException(ex); } }
/// <summary> /// 创建子窗体 /// </summary> /// <param name="form">窗体</param> /// <param name="module">模块</param> private void CreateOleFile(BaseFormEx form, Base_Module module) { form.FormClosed += form_FormClosed; form.FormClosing += form_FormClosing; form.Text = module.FullName; form.Tag = module; form.MdiParent = this; form.ShowIcon = true; form.Show(); XtraMdiTabPage page = this.xtraTabbedMdiManager.Pages[form]; if (module.Icon != null) { page.Image = this.Img_Module.Images[module.Icon]; } showModels.Add(module); }
/// <summary> /// 显示窗体 /// </summary> /// <param name="title"></param> /// <param name="xtraForm"></param> private void ShowForm(string title) { splashScreenManager.ShowWaitForm(); Cursor currentCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; XtraFormBase xtraForm = null; switch (title) { case "搜索": Cursor.Current = currentCursor; splashScreenManager.CloseWaitForm(); searchForm.StartPosition = FormStartPosition.CenterParent; searchForm.ShowDialog(); return; case "整板结果": xtraForm = new ShowDetailNew(); break; case "整板统计": xtraForm = new Statistical(); break; //case "我是测试2": // xtraForm = new ShowDetail2(); // break; } try { XtraMdiTabPage tabPage = GetTabPage(title); if (tabPage != null) { xtraTabbedMdiManager1.SelectedPage = tabPage; } else if (xtraForm != null) { xForms.Add(title, xtraForm); xtraForm.Text = title; xtraForm.MdiParent = this; xtraForm.Show(); } } finally { Cursor.Current = currentCursor; splashScreenManager.CloseWaitForm(); } }
private void biCloseAllExcept_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { XtraMdiTabPage page = mdiManager1.SelectedPage; foreach (Form f in this.MdiChildren) { if (f != page.MdiChild) { if (f.Tag.ToString() == "main") { continue; } FormList.Remove(f.Tag.ToString()); f.Close(); f.Dispose(); } } }
/// <summary> /// 窗体关闭事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void form_FormClosing(object sender, FormClosingEventArgs e) { //是否锁定 XtraMdiTabPage page = this.xtraTabbedMdiManager.Pages[(BaseFormEx)sender]; if (page != null) { //提示信息 if ((page.MdiChild.Tag as Base_Module) == null) { e.Cancel = true; } else { e.Cancel = false; } } }
private void navBarItem7_LinkClicked(object sender, NavBarLinkEventArgs e) { this.HidePages(); XtraMdiTabPage page = (from t in this.xtraTabbedMdiManager1.Pages.Cast <XtraMdiTabPage>() where t.MdiChild.GetType() == typeof(FrmOperateLog) select t).SingleOrDefault <XtraMdiTabPage>(); if (page != null) { page.MdiChild.Show(); } else { new FrmOperateLog { MdiParent = this }.Show(); } }
private void popMenuCloseOther_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { XtraMdiTabPage selectedPage = xtraTabbedMdiManager1.SelectedPage; Type currentType = selectedPage.MdiChild.GetType(); for (int i = xtraTabbedMdiManager1.Pages.Count - 1; i >= 0; i--) { XtraMdiTabPage page = xtraTabbedMdiManager1.Pages[i]; if (page != null && page.MdiChild != null) { Form form = page.MdiChild; if (form.GetType() != currentType) { form.Close(); if (form != null && !form.IsDisposed) { form.Dispose(); } } } } }
private void navBarItem4_LinkClicked(object sender, NavBarLinkEventArgs e) { XtraMdiTabPage xtraMdiTabPage = (from XtraMdiTabPage t in this.xtraTabbedMdiManager1.Pages where t.MdiChild.GetType() == typeof(FrmCheck) select t).SingleOrDefault <XtraMdiTabPage>(); if (xtraMdiTabPage != null) { this.xtraTabbedMdiManager1.Pages.Clear(); this.xtraTabbedMdiManager1.Pages.Add(xtraMdiTabPage); xtraMdiTabPage.MdiChild.Hide(); } else { this.xtraTabbedMdiManager1.Pages.Clear(); } FrmHisOscillogram frmHisOscillogram = new FrmHisOscillogram(); this.panelControl6.Hide(); frmHisOscillogram.MdiParent = this; frmHisOscillogram.Show(); }
public RightClickTitleBarWindow(frmRibbonMain form, PopupMenu popupMenu, XtraMdiTabPage tagPage) { this.form = form; this.popupMenu = popupMenu; this.tagPage = tagPage; itemsForTabPage = new List<BarItemLink>(); ctrlItemsForTabPage = new List<BarItem>(); if (tagPage != null && tagPage.MdiChild != null) { Form selectedForm = tagPage.MdiChild; if (selectedForm is IFormRefresh) { BarButtonItem refresh_item = new BarButtonItem(); refresh_item.Caption = RightClickTitleBarDialog.MENU_TITLE_FORM_REFRESH_TEXT; refresh_item.Glyph = FWImageDic.REFRESH_IMAGE16; refresh_item.PaintStyle = BarItemPaintStyle.CaptionGlyph; refresh_item.ItemClick += new ItemClickEventHandler(refresh_item_ItemClick); itemsForTabPage.Add(popupMenu.ItemLinks.Add(refresh_item)); ctrlItemsForTabPage.Add(refresh_item); } if (selectedForm is IFormFURL) { BarButtonItem furl_item = new BarButtonItem(); furl_item.Caption = RightClickTitleBarDialog.MENU_TITLE_FORM_FURL_TEXT; furl_item.PaintStyle = BarItemPaintStyle.CaptionGlyph; furl_item.Glyph = FWImageDic.INFO_IMAGE16; furl_item.ItemClick += new ItemClickEventHandler(furl_item_ItemClick); itemsForTabPage.Add(popupMenu.ItemLinks.Add(furl_item)); ctrlItemsForTabPage.Add(furl_item); } } }
private void BenimMenumItemClickMethod(ItemClickEventArgs e) { try { RibbonForm f = FormBul(e.Item.Name); if (MDIFormAcikMi(f)) { XtraMdiTabPage page = FindPageByText(f.Text); xtraTabbedMdiManager1.SelectedPage = page; Ribbon.HideApplicationButtonContentControl(); return; } Ribbon.HideApplicationButtonContentControl(); f.Ribbon.MdiMergeStyle = RibbonMdiMergeStyle.Always; f.MdiParent = Master.ActiveForm; //this; f.Show(); Ribbon.SelectedPage = f.Ribbon.Pages[0]; } catch (Exception Hata) { //Genel.LogErrorYaz(iFormID, Hata); //XtraMessageBox.Show(Genel.DilGetirMesaj(1034) + "\n\n" + Hata.Message, Genel.DilGetirMesaj(2), MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void xtraTabbedMdiManager1_MouseDown(object sender, MouseEventArgs e) { XtraMdiTabPage curPage = (sender as XtraTabbedMdiManager).SelectedPage; if (e.Button == MouseButtons.Left) { DateTime dt = DateTime.Now; TimeSpan span = dt.Subtract(lastClick); if (span.TotalMilliseconds < 300) { if (this.MdiChildren.Length > 0) { if (curPage.Equals(lastPage)) { this.ActiveMdiChild.Close(); } } lastClick = dt.AddMinutes(-1); } else { lastClick = dt; lastPage = curPage; } } }