form embedded in The panel (C #)

Source: Internet
Author: User

Embed this form directly into a panel.

Examples are as follows:

Form to embed:

 Public Partial class Formembed:form    {        public  formembed ()        {            InitializeComponent ();        }         Private void button1_click (object  sender, EventArgs e)        {            this//  The Close method cannot be called because the form is freed after Close and cannot be show again        }    }

Place a container in the main form panel (or TabControl's TabPage):

 Privateformembed frmembed =NewFormembed ();//Global Variables         PublicForm1 () {InitializeComponent (); }         //Show        Private voidButton1_Click (Objectsender, EventArgs e) {            if(Frmembed! =NULL) {Frmembed.formborderstyle= Formborderstyle.none;//No BorderFrmembed.toplevel =false;//not the top-level formPanel1. Controls.Add (frmembed);//Add to PanelFrmembed.show ();//Show            }        }       //Hidden        Private voidButton2_Click (Objectsender, EventArgs e) {            if(Frmembed! =NULL) {frmembed.hide (); }        }

form embedded in The panel (C #)

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.