首页 > 代码库 > 多文档界面的实现(DotNetBar的superTabControl)

多文档界面的实现(DotNetBar的superTabControl)

private void FormMain_Load(object sender, EventArgs e)        {            superTabControl2.Tabs.Clear();            timer1.Start();            buttonX1_Click(null, null);        }        /// <summary>        /// 创建或者显示一个多文档界面        /// </summary>        /// <param name="caption">窗体标题</param>        /// <param name="formType">窗体类型</param>        public void SetMdiForm(string caption,Type formType)        {            #region                         var tab = superTabControl2.Tabs               .Cast<SuperTabItem>()               .FirstOrDefault(x => x.Text == caption && x.AttachedControl.GetType() == formType);                //如果在现有Tab页面中没有找到,那么就要初始化了Tab页面了                if (tab==null)                {                    var form = Activator.CreateInstance(formType) as Form;                    form.TopLevel = false;                    form.FormBorderStyle = FormBorderStyle.Fixed3D;                    form.Dock = DockStyle.Fill;                    //form.Visible = true;                    tab = new SuperTabItem();                    tab.Name = caption;                    tab.Text = caption;                    tab.AttachedControl=form as Control;                    superTabControl2.Tabs.Add(tab);                    superTabControl2.SelectedTab = tab;                    superTabControlPanel4.Controls.Add(form);                            }                superTabControl2.SelectedTab = tab;            #endregion                   }        private void buttonXSetPwd_Click(object sender, EventArgs e)        {            SetMdiForm("修改用户名和密码",typeof(FormSetPwd));        }

 

多文档界面的实现(DotNetBar的superTabControl)