1. form 设置为 private 始终 只打开一个2.NavBarControl尝试设置Item的属性LargeImageIndex的值,则发现没有任何变化,这是为什么呢?原来在设置这个属性之前还需要设置此Item所在Group的属性GroupStyle的值为LargeImageText。3. xtraTabbedMdiManager1.SelectedPage = xtraTabbedMdiManager1.Pages[f1]; // 选中page xtraTabbedMdiManager1.Pages[f1].Image = navBarItem1.SmallImage;// page设置图片 this.xtraTabbedMdiManager1.ClosePageButtonShowMode = DevExpress.XtraTab.ClosePageButtonShowMode.InAllTabPagesAndTabControlHeader; 4. 双击保存using DevExpress.XtraTabbedMdi;using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace WindowsFormsApplication15{ public partial class Form1 : Form { public Form1() { InitializeComponent(); xtraTabbedMdiManager1.MdiParent = this; } private void navBarControl1_Click(object sender, EventArgs e) { Form2 f1 = Form2.CreateFrom(); f1.MdiParent = this; f1.Show(); xtraTabbedMdiManager1.SelectedPage = xtraTabbedMdiManager1.Pages[f1]; xtraTabbedMdiManager1.Pages[f1].Image = navBarItem1.SmallImage; } private void navBarItem2_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { Form3 f1 = Form3.CreateForm(); f1.MdiParent = this; f1.Show(); xtraTabbedMdiManager1.SelectedPage = xtraTabbedMdiManager1.Pages[f1]; xtraTabbedMdiManager1.Pages[f1].Image = navBarItem1.SmallImage; } private DateTime m_LastClick = System.DateTime.Now; private XtraMdiTabPage m_lastPage = null; 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(); curPage.MdiChild.Close(); //} } } m_LastClick = dt.AddMinutes(-1); } else { m_LastClick = dt; m_lastPage = curPage; } } } private void Form1_Load(object sender, EventArgs e) { } }}/*************/ form using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace WindowsFormsApplication15{ public partial class Form2 : Form { private Form2() { InitializeComponent(); } private static Form2 instance; public static Form2 CreateFrom() { //判断是否存在该窗体,或时候该字窗体是否被释放过,如果不存在该窗体,则 new 一个字窗体 if (instance == null || instance.IsDisposed) { instance = new Form2(); } return instance; } private void Form2_Load(object sender, EventArgs e) { } }}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。