WinForms: Using the Dock Manager to setup layout of the query building area
It's easy to manage dock panels right from the Visual Studio form designer. Just add the DockManager control on a form and click the Tasks button in the top-right corner of the control:
The new DockPanel will be added and displayed on the side strip as a tab. You can click on the tab to expand the panel. After that, you can place any control on the panel.
Set the AutoHide and Position properties of DockPanel to tune its initial state.
You can add as many side panels as you wish:
To delete a panel, click on its header and press the Del key.
The user will be able to change panels state, i.e. to pin a panel or to drag it to another docking position. Read and write the DockManager.DockPanelsLayoutXML property to save and load the current panels state to keep it between work sessions.
The code sample below creates the SQLText Editor control as a hideable bottom dock panel beneath the Design Pane.
using ActiveQueryBuilder.View.WinForms;using ActiveQueryBuilder.View.WinForms.DockPanels; using ActiveQueryBuilder.View.WinForms.QueryView; DockManager dockManager = new DockManager(); dockManager.Controls.Add(new DesignPaneControl()); DockPanel dockPanel = new DockPanel(); dockPanel.Text = "SQL"; dockPanel.Docking = Docking.Bottom; dockPanel.AutoHide = false; dockPanel.Controls.Add(this.sqlTextEditor1); dockManager.DockPanels.Add(dockPanel);