(Revised for content quality)
We had built forms based application for a customer based on their requirements. Toward the end of the project, they decided they wanted the app to function as a part of another Winforms app in a way that required the screens to be contained within larger forms. They also wanted to dynamically load forms and other UI elements. I decided to try simply loading forms dynamically inside another form, at at the time, wasn't comfortable with changing over all of the forms to controls.
When I load a form dynamically inside another form or container control, the editing behavior of the inner form's components changes. Text editing, in a TextBox or ComboBox, does not allow me to select partial text with the mouse, though I can double click to select all the text in the control.
FormChild form = new FormChild();
form.TopLevel = false;
form.Dock = DockStyle.Fill;
Controls.Clear();
Controls.Add(form);
form.Show();
The controls work as expected when I show the form normally, using Show() or ShowDialog(), but not when nested.
Being a bit new to Winforms from years of MFC, we had experience embedding forms inside MFC controls using FormView without issues, so assumed it would work ok with Winforms. It didn't turn out that way.
SOLUTION: I should have used a User Control in the first place. I refactored every form in the app manually, created blank controls, cut and pasted the InitializeComponent() as well as the logic into a User Control. As for the dynamic components, nowadays I create them at runtime, or do them in IronPython. Four years later I'm looking back at this question, shaking my head at my rookie mistake.
In addition, I've found that controls inside dockable panels work well for the original scenario I was faced with. Specifically, I started using DevExpress' DocumentManager and DockPanel. My inexperience at the time with Winforms got us into trouble; I've left this question in case someone else makes the same mistake.
Forms
in winforms are equivalentwindows
in many other systems. – µBio