Using the Panel control implementation in C # to nest another form in one form

Source: Internet
Author: User

Using the Panel control implementation in C # to nest another form in one form
Showallpage sallpage = new Showallpage ();
Sallpage.formborderstyle = Formborderstyle.none;
Sallpage.dock = DockStyle.Fill;
Sallpage.toplevel = false;
This. MainPanel.Controls.Clear ();
This. MAINPANEL.CONTROLS.ADD (Sallpage);
Sallpage.show ();

Mainpanel The Panel control in the main form, showallpage the form in the panel to be displayed in the primary form.

--------------------------------------------------------------------------------------------------------------- -----------------------------------------------------

FormBorderStyle property to set the border style of a new form
Dock property gets or sets which border is docked to the parent box body and determines how to resize with the parent box body
These two properties can be added without

But in the simplest way, it is the use of MDI
First, the parent window wants to set the IsMdiContainer property to True. To implement the parent-child window of an MDI structure
Then change to the following code in the window jump:
Example: General jump: Form1 f=new Form ();
F.show ();
Switch
Form1 C = new Form1 ();
C.mdiparent = this;
C.show ();
However, sometimes you encounter a problem, that is, the subform will jump out of the parent form of the 0, 0 coordinates, so in the parent form if there is a menu bar, the subform will be obscured, then we will be in the subform Form_Load () plus a sentence to set its distance from the top edge of the form
This. Top = 100;
This completes the nesting of one form in another form

Using the Panel control implementation in C # to nest another form in one form

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.