1.添加Document
Form2 form2 = new Form2(); form2 .Dock = DockStyle.Fill; this.documentManager1.View.BeginUpdate(); this.documentManager1.View.AddDocument(form2 ).Caption = "测试"; this.documentManager1.View.ActivateDocument(form2 ); this.documentManager1.View.EndUpdate();
2.让 TabbedView显示指定document
int index = 0; foreach (var document in tabbedView1.Documents) { if (document.Caption == "测试") { tabbedView1.ActivateDocument(document.Control);//激活测试界面 } index++; }
3.documentManager关闭Document事件
tabbedView1.DocumentClosing += TabClose; private void TabClose(object sender, DocumentCancelEventArgs e) { if (e.Document.Caption == "测试") { e.Cancel = true; //取消关闭事件 } }
4.设置标签卡在底部
tabbedView1.DocumentGroupProperties.HeaderLocation = DevExpress.XtraTab.TabHeaderLocation.Bottom;