Moon Moon - 1 month ago 5x
C# Question

C# Winform Forms in Form

i want to open multiple instances of one form and display it in another form or paenel of another form. how to do it


If you're not using MDI, you can still add a form to another form, or to a panel on a form.

public Form1()

    Form2 embeddedForm = new Form2();
    embeddedForm.TopLevel = false;

You will need to set the FormBorderStyle to None, unless you want to have an actual movable form inside your form.

If you want to do this to create a reusable "template" to use in multiple forms, you should consider creating a user control instead. Not to be confused with a custom control, which is intended for when you need to do your own drawing instead of using collections of standard Windows controls.

I'm not entirely sure what your intentions are, but MDI (as mentioned in one of the other answers) might actually be what you're looking for.