问题
The VCL does not natively allow forms other than the MainForm to host MDI child forms. This is a hard-coded limitation on Borland's part, not a limitation in Microsoft's MDI architecture. Microsoft allows multiple windows in an application to host MDI children. There is no concept of MainForms in the Win32 API.
I have tried converting the below embarcadro c++ example to embarcadro delphi without success. I keep encountering the error "no mdi forms are currently active" when creating the mdi child forms.
This c++ sample demonstrates how to allow a non-MDI project to host multiple MDI parent forms, none of which are the VCL's MainForm.
Download with Information (Account required to download) http://cc.embarcadero.com/item/23574
Direct Download (No account required to download) http://www.delphibasics.info/MultipleMDIParentFormsInASingleApplication.zip
I would be grateful if someone would convert this sample from embarcadro c++ language to embarcadro delphi language. Thank you.
回答1:
Quality Central #12006 Hosting MDI child forms in non-MainForm forms has detailed steps in its workaround description for how to add support for that. It does involve patching the VCL sources though, and was posted against Delphi 2005, so some of the steps may have changed. It's also been closed as Won't Do, so if you pursue that approach you'll have to maintain it yourself long-term.
来源:https://stackoverflow.com/questions/10129890/multiple-mdi-parent-forms-in-a-single-application