The following tutorial will teach you how to create a simple docking framework from code:
C# |
Copy Code
|
---|---|
using Nevron.UI.WinForm.Controls; using Nevron.UI.WinForm.Docking; |
Visual Basic |
Copy Code
|
---|---|
Imports Nevron.UI.WinForm.Controls Imports Nevron.UI.WinForm.Docking |
C# |
Copy Code
|
---|---|
private NDockManager dockManager;
|
Visual Basic |
Copy Code
|
---|---|
Private dockManager As NDockManager |
C# |
Copy Code
|
---|---|
protected virtual void CreateDockManager() { dockManager = new NDockManager(); dockManager.Form = this; dockManager.Palette.Scheme = ColorScheme.LunaBlue; } |
Visual Basic |
Copy Code
|
---|---|
Protected Overridable Sub CreateDockManager() dockManager = New NDockManager() dockManager.Form = Me dockManager.Palette.Scheme = ColorScheme.LunaBlue End Sub |
C# |
Copy Code
|
---|---|
protected virtual void CreateSimpleLayout() { NDockingPanel panel; INDockZone root = dockManager.RootContainer.RootZone; INDockZone target; //add panel on the left side of the root panel = new NDockingPanel(); panel.SizeInfo.PreferredSize = new Size(100, 200); panel.PerformDock(root, DockStyle.Left); //add panel on the right side of the root panel = new NDockingPanel(); panel.SizeInfo.PreferredSize = new Size(100, 200); panel.PerformDock(root, DockStyle.Right); //get the parent zone of the panel and add one at the bottom of it target = panel.ParentZone; panel = new NDockingPanel(); panel.PerformDock(target, DockStyle.Bottom); //add panel at the bottom of the root panel = new NDockingPanel(); panel.SizeInfo.PreferredSize = new Size(150, 100); panel.PerformDock(root, DockStyle.Bottom); //add panel at the top of the root panel = new NDockingPanel(); panel.SizeInfo.PreferredSize = new Size(150, 100); panel.PerformDock(root, DockStyle.Top); //add child panel to the last one target = panel.ParentZone; panel = new NDockingPanel(); panel.PerformDock(target, DockStyle.Fill); } |
Visual Basic |
Copy Code
|
---|---|
Protected Overridable Sub CreateSimpleLayout() Dim panel As NDockingPanel Dim root As INDockZone = dockManager.RootContainer.RootZone Dim target As INDockZone 'add panel on the left side of the root panel = New NDockingPanel() panel.SizeInfo.PreferredSize = New Size(100, 200) panel.PerformDock(root, DockStyle.Left) 'add panel on the right side of the root panel = New NDockingPanel() panel.SizeInfo.PreferredSize = New Size(100, 200) panel.PerformDock(root, DockStyle.Right) 'get the parent zone of the panel and add one at the bottom of it target = panel.ParentZone panel = new NDockingPanel() panel.PerformDock(target, DockStyle.Bottom) 'add panel at the bottom of the root panel = New NDockingPanel() panel.SizeInfo.PreferredSize = New Size(150, 100) panel.PerformDock(root, DockStyle.Bottom) 'add panel at the top of the root panel = New NDockingPanel() panel.SizeInfo.PreferredSize = New Size(150, 100) panel.PerformDock(root, DockStyle.Top) 'add child panel to the last one target = panel.ParentZone panel = New NDockingPanel() panel.PerformDock(target, DockStyle.Fill) End Sub |
C# |
Copy Code
|
---|---|
public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); CreateDockManager(); CreateSimpleLayout(); } |
Visual Basic |
Copy Code
|
---|---|
Public Sub New() ' ' Required for Windows Form Designer support ' InitializeComponent() CreateDockManager() CreateSimpleLayout() End Sub |