A ToolWindow is considered docked when it is positioned to the top, left, right, or bottom of the DockHost or ClientHost. Interactively, a floating tool window can be docked by double-clicking in its caption or by dragging it until its drop-cue indicates that its state will docked. Tool windows can be docked at any time unless the Dock-layout Manager's AllowDocking property is set to false. Only a docked tool window can be unpinned (state changed to AutoHide) or pinned (state changed to Docked).
When a tool window is docked, it occupies all the space available to it. For example, if a tool window is docked to the top or bottom of the dock-host, it will occupy the entire width and its height will be determined by the value of its Height property. If a tool window is docked to the left or right of the dock-host, it will occupy the entire height and its width will be determined by the value of its Width property. In both cases, the remaining space will be occupied by the client-host. If a client-host was not defined (e.g., Mdi application), the tool window will occupy the entire space available in the dock-host.
Programmatically, finer handling of a tool window's state and location can be had using the DockTo method. The DockTo method allows for a tool window to docked in the dock-host, around the client-host, or with another tool window (see Example 1).
To dock a group of tool windows, the DockTo method of the ParentGroup of any one of the tool windows in the group must be used. If, rather than using the DockTo method, the parent group's State property is changed to Docked, each tool window in the group will return to its own last known docked location. If a tool window had never previously been docked, it will be docked to the left of the DockHost. Keep in mind that if a tool window is docked within a floating tool window, then its state is considered to be floating and not docked.
Title Text |
Copy Code |
---|---|
Type your code here. |
Example 1: Docking tool windows
The following example demonstrates how to dock tool windows using the DockTo method
VB.NET | Copy Code |
---|---|
|
C# | Copy Code |
---|---|
|