暂时隐藏模态对话框 [英] Temporarily Hide a Modal Dialog

查看:86
本文介绍了暂时隐藏模态对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我显示了一个模态对话框,其中主应用程序窗口设置为所有者(如dialog.ShowDialog(mainAppWindow)中所示),我想暂时允许用户与主应用程序窗口进行交互,然后再次返回模态对话框.

I have a modal dialog displayed with the main application window set as owner (as in dialog.ShowDialog(mainAppWindow)) and I would like to temporarily allow the user to interact with the main application window before returning to the modal dialog again.

我该怎么做?我正在使用Windows窗体.

How can I do this? I am using Windows Forms.

AutoCAD可以做到这一点.

AutoCAD does this well.

推荐答案

只需关闭模式对话框.它不会像普通的Form实例那样处理,因此您只需将其DialogResult属性设置回None并再次调用ShowDialog()即可使其恢复活动.

Just close the modal dialog. It doesn't get disposed like normal Form instances do so you simply bring it back alive by setting its DialogResult property back to None and calling ShowDialog() again.

请注意,在模式对话框中调用Hide()也会将其关闭,因为您的应用程序的所有窗口均已禁用,所以一定要关闭它.与Close()没什么不同.

Note that calling Hide() on a modal dialog also closes it, necessarily so since all of your app's windows are disabled. No different from Close().

这篇关于暂时隐藏模态对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆