Devexpress - 如何以表格式视图打开表单

时间:2016-03-08 23:51:20

标签: winforms devexpress

我在左边有一个带有树状列表的功能区表单,所以我放了一个XtraUserControl来插入一个DocumentManager,我想在其中添加所有选项卡表单(就像在Visual Studio中一样)。 我怎样才能做到这一点? 感谢

2 个答案:

答案 0 :(得分:2)

我建议您从How to: Display Documents Using a Tabbed UI示例开始。此示例的主要思想是您可以将DocumentManager添加到表单上,然后处理一个树形表项。单击以将所有需要的子表单添加为MDI子项 - DocumentManager将自动跟踪所有更改:

Form childForm = new Form();
childForm.MdiParent = this;
childForm.Show();

要阅读有关其他Document Manager概念和功能的更多信息,请参阅相应的documentation articles

答案 1 :(得分:0)

    public void Viewchild(Form _form)
    {
        //Check Before Open
        if (!IsFormActive(_form))
        {
            _form.MdiParent = this;
            _form.Show();
        }
    }
    //Check If a Form Is Opened Already
    private bool IsFormActive(Form form)
    {
        bool IsOpened = false;
        //If There Is More Than One Form Opened
        if (MdiChildren.Count() > 0)
        {
            foreach (var item in MdiChildren)
            {
                if (form.Name == item.Name)
                {
                    // Active This Form
                    xtraTabbedMdiManager1.Pages[item].MdiChild.Activate();
                    IsOpened = true;
                }
            }
        }
        return IsOpened;
    }

打开表单  Master.frmBranch fb =新的Master.frmBranch();             fb.Name =“ frmBranch”;