简体   繁体   中英

Transform Form1 into Form2

I have a Form1 with a panel on the left side of the Window and I want to make Form2 appear when I click the button "Test" on the right side (where it is the Label "Test"). Is there any possibility or I have to write the code for each new thing I want to put on the right side? Here is an image: Image

Instead of using a second form, use a User Control .
If you are really determined to make a second form appear in your first form, try making the second form a child of the first form using this code inside of the first form's code:

  this.IsMdiContainer = true;
    Form2 form = new Form2();
    form.Parent = this;
    form.Show();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM