在下面的示例中,创建了三个面板,并停靠它们来形成分隔式容器。 然后把 分隔式容器 容器的 DockPanel.Tabbed 属性设置为 true,并因此而把分隔式容器转换为 标签式容器。 结果显示如下:

C#CopyCode image复制代码
using DevExpress.XtraBars.Docking;
// ...
// Create a panel and dock it to the left edge of the form.
DockPanel p1 = dockManager1.AddPanel(DockingStyle.Left);
p1.Text = "Panel 1";
// Add a button to the panel.
DevExpress.XtraEditors.SimpleButton btn = new DevExpress.XtraEditors.SimpleButton();
btn.Text = "Print...";
p1.ControlContainer.Controls.Add(btn);

// Add a new panel to the first panel. This forms a split container.
DockPanel p2 = p1.AddPanel();
p2.Text = "Panel 2";

// Add a new panel to the split container.
DockPanel p3 = p1.ParentPanel.AddPanel();
p3.Text = "Panel 3";
// ...

// Transform the split container into a tab container.
p1.ParentPanel.Tabbed = true;
Visual BasicCopyCode image复制代码
Imports DevExpress.XtraBars.Docking
' ...
' Create a panel and dock it to the left edge of the form.
Dim p1 As DockPanel = DockManager1.AddPanel(DockingStyle.Left)
p1.Text = "Panel 1"
' Add a button to the panel
Dim btn As DevExpress.XtraEditors.SimpleButton btn = New DevExpress.XtraEditors.SimpleButton()
btn.Text = "Print..."
p1.ControlContainer.Controls.Add(btn)

' Add a new panel to the first panel. This forms a split container.
Dim p2 As DockPanel = p1.AddPanel()
p2.Text = "Panel 2"

' Add a new panel to the split container.
Dim p3 As DockPanel = p1.ParentPanel.AddPanel()
p3.Text = "Panel 3"
'...

' Transform the split container into a tab container.
p1.ParentPanel.Tabbed = True