在下列代码中创建了两个面板,然后把它们组合到一个 标签式容器 中。 通过 DockPanel.DockAsTab 方法创建了一个标签式容器,并且稍后此方法可以用于在标签式容器中新建标签页。
在标签式容器中的标签页包含了由该方法的 index 参数指定的面板。 在本例中,包含第二个面板 ( dp2) 的标签页将被添加为第一个标签页,因为 index 参数被设置为 0。
结果显示如下:
C# | 复制代码 |
---|---|
using DevExpress.XtraBars.Docking; // .. // Create two floating panels. DockPanel dp1 = dockManager1.AddPanel(DockingStyle.Float); dp1.Text = "Panel 1"; DockPanel dp2 = dockManager1.AddPanel(DockingStyle.Float); dp2.Text = "Panel 2"; // Create a tab container consisting of these panels. // Panel dp2 will be displayed within the first tab. dp2.DockAsTab(dp1, 0); |
Visual Basic | 复制代码 |
---|---|
Imports DevExpress.XtraBars.Docking ' ... ' Create two floating panels. Dim dp1 As DockPanel = DockManager1.AddPanel(DockingStyle.Float) dp1.Text = "Panel 1" Dim dp2 As DockPanel = DockManager1.AddPanel(DockingStyle.Float) dp2.Text = "Panel 2" ' Create a tab container consisting of these panels. ' Panel dp2 will be displayed within the first tab. dp2.DockAsTab(dp1, 0) |