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
2009-09-15 13:57:39
+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
2009-09-15 14:00:13