C # display the child form in the parent container

Source: Internet
Author: User

Form2 form = new form2 ();
Form. formborderstyle = formborderstyle. None;
// Hide the border of the child form (remove the smallest flower, maximize, close, and other buttons)
Form. toplevel = false;
// Indicates that the subform is not a top-level form.
This. panel1.controls. Add (form); // load the subform into the panel.
Form. Show ();

Method 2: Specify the parent container implementation
Form2
Form = new
Form2 ();
Form. mdiparent = This; // specify the current form as the top-level MDI form
Form. Parent = This. Panel1; // indicates that the parent container of the child form is
FRM. formborderstyle
= Formborderstyle. None; // hide the border of the sub-form. Of course, it can also be implemented in the form loading event of the sub-form.
Panelform. Show ();

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.