问题
I need to open with Showdialog() in mdi form because I need to stop code until the mdichild finish.
The structure of program is this, I open a mdichild in onCreate of this I instead the class and in the constructor I open de SearchForm
There's the code:
frm_bsq_persona busqueda_persona = new frm_bsq_persona();
busqueda_persona.MdiParent = this.MdiParent.MdiParent;
busqueda_persona.Show();
Thank you very much.
回答1:
MDI child as dialog form (MDI modal workaround)
http://www.codeproject.com/Articles/48436/MDI-child-as-dialog-form-MDI-modal-workaround
It works by disabling all of the controls on the parent form, and providing you with an EventReceiver method to receive the DialogResult from the dialog.
There are some caveats. State of the parent form is not preserved perfectly, since all controls are re-enabled on return. If you want that, you'll have to save the state of the parent form (or maybe just those controls that are already disabled) before creating the dialog, and restore the state when the Event Receiver is called.
来源:https://stackoverflow.com/questions/15055854/showdialog-in-mdi