The dockpanel has a floating form, that is, the C # editor style, such:
Floating forms can be floating, docked (up or down), and paged (such as the file entry page ).
Follow these steps:
(1) first find weifenluo. winformsui. Docking. dll and download weifenluo. winformsui. Docking. dll (click to download ).
(2) Add the form to reference, create form 1 as the main form, and form 2 and Form 3 as the sub form. Add the dockpanle tool.
(3) Main formCode: Drag and Drop dockpanle to the main form and add the code dockpanel1.documentstyle = documentstyle. dockingmdi;
(4) subform: child form inherited from: weifenluo. winformsui. Docking. dockcontent, not inherited from form; define child form object
Form1 F1 = new form1 ();
F1.showhint = dockstate. Document;
F1.show (dockpanel1 );
The display effect is displayed.
In addition, the record status is recorded, which is retained when it is opened next time. Use the following method to load the record status:
(1) Private deserializedockcontent DDC;
(2) Private idockcontent getcontentfrompersiststring (string persiststring)
{
If (persiststring = typeof (F1). tostring ())
Return F1;
If (persiststring = typeof (F2). tostring ())
Return F2;
Else
{
Return NULL;
}
}
(3)
String configfile = path. Combine (path. getdirectoryname (application. executablepath), "dockpanel. config ");
If (file. exists (configfile ))
Dockpanel1.loadfromxml (configfile, DDC );
DDC = new deserializedockcontent (getcontentfrompersiststring );
The above method loads the saved status,
String configfile = path. Combine (path. getdirectoryname (application. executablepath), "dockpanel. config ");
Dockpanel1.saveasxml (configfile );
In addition, to implement interaction between various dockpanle sub-forms, for example, in the vs Editor, when designing the interface, select a text box, and the attributes in the property box change accordingly, which can be solved through delegation, see the delegated application of this blog.