Use of dockpanel

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.