1. Create a WinForm project, which generates a WinForm form Form1 by default.
2. Refer to add Reference, browse->weifenluo.winformsui.docking.dll.
3. Set the Form1 form Properties ismdicontainer:true.
4. Browse->weifenluo.winformsui.docking.dll-> in the Toolbox with the option->.net component, right-click, Toolbox, DockPanel.
5. Drag dockpanel onto the form FORM1, set the Dock property, I set: Fill.
Docked form:
1. Create a new WinForm form Form2.
2. Modify the form in the code to inherit from Dockcontent.
Using WeifenLuo.WinFormsUI.Docking;
public partial class Form2:dockcontent
3. Display the docked form in the main form Form1.
private void Form1_Load (object sender, EventArgs e)
{
Form2 Form2 = new Form2 ();
Form2. Show (THIS.DOCKPANEL1);
}
If DockPanel is nested on another 1 container control (for example: Panel), set the DockPanel property Documentstyle to: DOCKINGWINDOW/DOCKINGSDI
Use of DockPanel