Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

winforms

panel

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

Lets say i have a form A with a panel Panel_of_A and a form B with a panel Panel_of_B

I want to display contents of Panel_of_A into Panel_of_B or you may say i want to use Panel_of_A in another form.

Or you may provide help for displaying a form say A into a panel on form B.

Hope i made u understand my thoughts...

like image 313
Mobin Avatar asked May 11 '09 10:05

Mobin


People also ask

How do I copy a winform file?

Press "Ctrl" and drag your mouse to duplicate a existing form class file. Then exlude the existing form class file from the project. Rename the new form class file.

How can I run another application within a panel of my C# program?

Using the win32 API it is possible to "eat" another application. Basically you get the top window for that application and set it's parent to be the handle of the panel you want to place it in. If you don't want the MDI style effect you also have to adjust the window style to make it maximised and remove the title bar.


1 Answers

I think a better way for doing this is to create a User Control which contains that panel and (re)use it on both forms.

Here is a tutorial how to create User Controls on MSDN.

like image 180
splattne Avatar answered Oct 19 '22 00:10

splattne