Can we use a winform panel from another winform in C #?

I want to use a win form in C # and display its contents or the entire form in a panel used in another form.

Suppose I have Form A with Panel_of_A and Form B with Panel_of_B

I want to display the contents of Panel_of_A in Panel_of_B, or you can say that I want to use Panel_of_A in a different form.

Or you can provide help to display a form, say, A in a form panel B.

I hope that I understood that I understood my thoughts ...

+5
source share
5 answers

I think the best way to do this is to create a User Control that contains this panel, and (re) use it in both forms.

MSDN.

+10

, , , .

+4

FormA FormB? UserControl, , , , , .

fa = new FormA();
fa.TopLevel = false;
fa.FormBorderStyle = FormBorderStyle.None;
fa.Dock = DockStyle.Fill; 

fb = new FormB();
fb.panel1.Controls.Add(fa); // if panel1 was public

fa.Show();
fb.Show();
+2

, , . , , -, .

+1

() Composite UI Application Block

:

It presents proven methods for building complex smart client user interfaces based on well-known design patterns such as composite drawing, into which simple parts of the user interface can be combined to create complex solutions, but at the same time allowing these parts to be independently developed, tested and is deployed.

0
source

All Articles