Reputation: 11770
Is it possible to dock a form1 to a panel contained in another form2? I'm launching form1 with ShowDialog from a form2 event.
Upvotes: 1
Views: 3022
Reputation: 1508
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!
Upvotes: 1
Reputation: 37850
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.
Upvotes: 1
Reputation: 185593
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.
Upvotes: 1