ShowDialog in mdi

寵の児 提交于 2019-12-12 04:44:51

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!