tags:

views:

256

answers:

3

Is it possible to dock a form1 to a panel contained in another form2? I'm launching form1 with ShowDialog from a form2 event.

A: 

Not with ShowDialog (or even Show), no. A form that has already been displayed as a top-level form cannot later be added as a subcontrol of any other control. You can try to keep the form within a particular set of screen bounds by monitoring the LocationChanged event, but that will appear jerky on the screen.

Adam Robinson
+1  A: 

Consider extracting the controls out of form1 into a UserControl. Use that UserControl on form1 (assuming you need it as a form as well as the docked control), then dock the UserControl on form2 to implement the desired functionality.

John Rudy
+1  A: 

Consider using the COMPLETELY FREE docking library to develop Visual Studio .Net style applications provided by this link. Believe me, it's a commercial quality and bug-free code!

ileon