1. 程式人生 > 實用技巧 >documentManager控制元件的使用記錄

documentManager控制元件的使用記錄

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;

  

5.待補充

轉載:https://blog.csdn.net/rocco_cui/article/details/87969717