I'm writing an MDI application with a lot of MDI child forms. I'm trying to add the ability to change the forms from an MDI child to a floating form and back again. So far I've managed to change them to floating forms, but when I try to change them back to MDI children, I get the following exception when calling Form.Show():
An unhandled exception of type 'System.ComponentModel.Win
n' occurred in System.Windows.Forms.dll
Additional information: Error creating window handle.
Note: The property 'ContainerForm' references an MDIContainer form.
I've already tried the pinvoke SetParent method, but this prevents my toolstrips from working. and you lose the vista windows transparency effects.
if (bConfined && this.MdiParent == null)
this.MdiParent = this.ContainerForm;
this.Show(); // <-- Exception occurs here
else if (!bConfined && this.MdiParent != null)
this.MdiParent = null;
// SetParent(this.Handle, this.ContainerForm.Handle);