Use dockpanel suite

Source: Internet
Author: User

Take a look at dockpanel suite and know how to use it.

This control is good and can easily implement window positioning, floating, dock, tab, and other interface effects such as vs 2003. I have time to download it today, it is quite easy to use. Let's take a look at it and forget it later.

Dockpanel provides several available classes, two of which are important: dockpanel and dockcontent,

Dockpanel is inherited from panel and is used to provide Floating Dock sub-windows for floating and dock scenarios,
Dockcontent is inherited from the form class and is used to provide a floating window base class. That is to say, the dockcontent object can be attached to any side, floating, or tab in the dockpanel object.

The process of building a docpanel-style program is:

1. Create a winform program and reference winformsui. dll;
2. For example, the main window of the program is frmmain. Set frmmain. ismdicontainer to true;
3. Put a dockpanel in frmmain, for example, the name is Panel1, set panel1.dock to fill, or the place you plan.
4. create a window class for your sub-document, that is, create a Windows form, and add any desired controls in the window designer. this will be the sub-window in your program. I made two:
One is frmchild, and an editbox with the Dock Fill is put in it,
The other name is frmproperty, with a Dock Fill propertygrid named propertygrid1,
It is useful to set these two parameters.
5. Open the code of frmchild and frmproperty, and change the class inheritance class from form to dockcontent;
For example:

Public class frmchild: weifenluo. winformsui. dockcontent // note that this is changed!
{

}

6. Add two private members to frmmain:
Frmchild FC;
Frmproperty FP;
The two members are used to save the pointers of the two new windows.
7. Write some code for the load of frmmain, as shown below:

Fc = new frmchild ();
Fp = new frmproperty ();
Fc.show(this.doc kpanel1 );
Fp.show(this.doc kpanel1 );
FP. propertygrid1.selectedobject = FC;
FP. propertygrid1.propertyvaluechanged + = new propertyvaluechangedeventhandler (propertygrid1_propertyvaluechanged );

FC. mousedown + = new mouseeventhandler (fc_mousedown );
FC. mouseup + = new mouseeventhandler (fc_mouseup );

It is very interesting to create two windows that are inherited from dockcontent, all of which have the capabilities of pasting, tab, and automatic hide.
Note that there is a new show () method for dockcontent. You can specify the dockpanel to show. Of course, write the dockpanel1 you have prepared;
Both show, and then specify the object to be displayed for the propertygrid1 of FP, that is, FC;
Then register the event handler. These statements are used to change the properties of the window and the properties of the window, we can dynamically see the impact of the attributes of these objects on their appearance and shape. For those who only want to create multiple window programs, the show is complete.
8. Due to the event registered above, add several Event Handlers below:

Private void propertygrid1_propertyvaluechanged (Object S, propertyvaluechangedeventargs E)
{

This.doc kpanel1.invalidate ();
This. FC. invalidate ();
// This. FC. Refresh ();

}

Private void fc_mousedown (Object sender, mouseeventargs E)
{
This. fp. propertygrid1.refresh ();
}

Private void fc_mouseup (Object sender, mouseeventargs E)
{
This. fp. propertygrid1.refresh ();
}

Run the command to check the effect? You put these two windows on the edge. It's interesting to try them all here.
You can also use this program to try the effects of various dockcontent attributes.

I almost forgot. Here we have the source code, which is quite good! That is, the connection speed from here is too slow.

Http://sourceforge.net/projects/dockpanelsuite/

 

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.