多文档界面的实现(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)); }
出处:http://www.cnblogs.com/tangchun/p/4141369.html
关注我】。(●'◡'●)
如果,您希望更容易地发现我的新博客,不妨点击一下绿色通道的【因为,我的写作热情也离不开您的肯定与支持,感谢您的阅读,我是【Jack_孟】!
本文来自博客园,作者:jack_Meng,转载请注明原文链接:https://www.cnblogs.com/mq0036/p/6298453.html
【免责声明】本文来自源于网络,如涉及版权或侵权问题,请及时联系我们,我们将第一时间删除或更改!
posted on 2017-01-18 23:03 jack_Meng 阅读(2693) 评论(1) 编辑 收藏 举报