使用DevExpress控件构造单文档多界面(标签页)

要求:

1、菜单栏

2、工具栏

3、左边可Dock的菜单项列表 单击在右边以Tab的形式展示

4、状态栏 显示操作信息

 

控件:

1、barmanger 可以用来实现124

2、dockmanager 实现dock

3、NavBarControl 实现列表功能 创建在DockManager中

4、xtraTabbedMaiManager 实现新窗口打开在标签页中的功能

 

对标签页的控制:

1、打开新的窗口

     private void OpenLink(BaseForm itemForm,string itemHeader)
        {
            //遍历已打开的TabPage,若发现已打开过则不再重复打开并设置为Active
            itemCount = xtraTabbedMdiManager1.Pages.Count;
            foreach (XtraMdiTabPage itemPage in xtraTabbedMdiManager1.Pages)
            {
                if (itemHeader == itemPage.Text)
                {
                    //MessageBox.Show("the page has been openned");
                    //设置活动Tab Page
                    xtraTabbedMdiManager1.SelectedPage = itemPage;
                    return;
                }
            }

            itemForm.MdiParent = this;
            itemForm.Text = itemHeader;
            itemForm.Show();

            //设置为Active
            xtraTabbedMdiManager1.SelectedPage = xtraTabbedMdiManager1.Pages[itemCount];
        }

2、获取当前Active的Form

 xtraTabbedMdiManager1.SelectedPage

 

 

3、关闭ActiveForm

 public void CloseTabPage()
        {
            if (ActiveMdiChild != null)
            {
                ActiveMdiChild.Close();
            }
        }

 

4、子窗口中调用Parent

 public  void CloseTabPage()
        {
            frmTabbedMDI frm = (frmTabbedMDI)this.ParentForm;
            if (frm != null)
            {
                frm.CloseTabPage();
            }
        }

展开阅读全文

没有更多推荐了,返回首页