Use of DockPanel (referencing WeifenLuo.WinFormsUI.Docking.dll components) in WinForm

Source: Internet
Author: User

WeiFenLuo.WinFormsUI.Docking.dll is a class library of the Open source project DockPanel Suite that allows you to dock, drag and drop Windows like Visual Studio. WeifenLuo.WinFormsUI.Docking is a very powerful interface layout control that can save a custom layout as an XML file that can load an XML configuration file. Several classes are available in DockPanel, with two important ones: DockPanel and Dockcontent. The DockPanel is inherited from the panel and is used to provide a floating and dock space for the subwindow of the floating dock; Dockcontent is inherited from the form class to provide a floating window base class. In other words, the Dockcontent object can be arbitrarily welt, floating, tabbing, and so on in the DockPanel object.

1. New WinForm Form

2. Modify WinForm Form Properties

 This true ;  This " MainForm " ;  This " MainForm ";

3. Add a menu bar for the MainForm form

4. Solution Manager--Add references--Browse-->weifenluo.winformsui.docking.dll

5. Toolbox--Select items ...-->.net framework Components--Browse-->weifenluo.winformsui.docking.dll

6. Drag the DockPanel control in the toolbox to the MainForm form and drag with the following error:

  

The Project Properties dialog box and the application-to-target framework,-->.net framework 4, can be resolved

7. Set the DockPanel Control Dock property to fill

this. Dockpanel1.dock = System.Windows.Forms.DockStyle.Fill;

8. Add two WinForm forms, Dockpanelformmain and Dockpanelformside respectively, and modify both forms in the Code of the form to inherit from Dockcontent. and modify its FormBorderStyle property to Fixed3D, set Dockpanelformmain's BackColor property to white;

9. Add the following code to the MainForm Load event:

Dockpanelformmain dockPanelMain1 =NewDockpanelformmain ();d ockpanelmain1.show ( This. DockPanel1);d Ockpanelmain1.text="MainPanel1";D ockpanelformmain dockPanelMain2=NewDockpanelformmain ();d ockpanelmain2.show ( This. DockPanel1);d Ockpanelmain2.text="MainPanel2";D ockpanelformside dockpanelsideleft=Newdockpanelformside ();d ockpanelsideleft.show ( This. DockPanel1, WeifenLuo.WinFormsUI.Docking.DockState.DockLeft);d Ockpanelsideleft.text="Dockpanelleft";D ockpanelformside dockpanelsideright=Newdockpanelformside ();d ockpanelsideright.show ( This. DockPanel1, WeifenLuo.WinFormsUI.Docking.DockState.DockRight);d Ockpanelsideright.text="Dockpanelright";D ockpanelformside Dockpanelsidebottom=Newdockpanelformside ();d ockpanelsidebottom.show ( This. DockPanel1, WeifenLuo.WinFormsUI.Docking.DockState.DockBottom);d Ockpanelsidebottom.text="Dockpanelbottom";

10, the program operation effect is as follows:

Reference Link: http://www.cnblogs.com/because/archive/2011/12/24/2300316.html

Use of DockPanel (referencing WeifenLuo.WinFormsUI.Docking.dll components) in WinForm

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.