如何通过显示新表单来阻止特定表单(.showdialog) [英] How do I block specific forms by showing a new form (.showdialog)

查看:92
本文介绍了如何通过显示新表单来阻止特定表单(.showdialog)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.Show和.ShowDialog的通常行为是明确的...

但是现在我有一个应用程序,其中一些表单打开子对话框并且应该被它们阻止(.ShowDialog),而ONE特定形式总是需要访问。

因此,新打开的表单应该阻止所有其他下(同一所有者/呼叫者或一行呼叫者)。但是,一个与主要形式平行的形式开放的形式应该从其他形式中解脱出来......



我希望这个很清楚;)否则请询问详情。



我的尝试:



申请表。第二次访问可访问的表单。

设置特定的所有者,这没有任何影响。奇怪的是,所有文档声称如此:〜所有者将被阻止...

The usual behavior of .Show and .ShowDialog is clear...
But now I have an application where some Forms open sub dialogs and shall be blocked by them (.ShowDialog), while ONE specific form always needs to be accessible.
So new opened forms shall block all the others "under" it (same owner/caller, or a line of callers). But one form, that opens in the beginning parallel to the main form, shall be free from the others...

I hope this was clear enough ;), otherwise please ask for details.

What I have tried:

Application.Run a second time for the accessible form.
setting specific owners, which didn't have any effect. Weirdly, all documentation claim so: ~"the owner will be blocked"...

推荐答案

没有标准的方法来执行此操作:当您调用ShowDialog时,它会显示作为应用程序模式对话框 - 这意味着在对话框被解除之前,您无法访问当前应用程序中的任何其他表单。

您不能使用Show和ShowDialog来创建模式和备用同时可以在同一个应用程序中使用。

为了做你想做的事情,你根本不能使用ShowDialog,并且必须模仿所有其他的模态效果当用户试图选择它们时,通过强制焦点回到模态窗体打开窗口。



另一种解决方案是打开始终可用 模态对话框中的表单(记得在调用ShowDialog之前关闭它)。



从用户的角度来看讨厌的片段设计......
There is no standard way to do this: when you call ShowDialog it displays as an Application Modal dialog - which means that you cannot access any other forms from the current application until the dialog has been dismissed.
You can't use Show and ShowDialog to have a modal form and a "spare" form both usable within the same application at the same time.
In order to do what you want, you can't use ShowDialog at all, and will have to emulate the modal effect in all other windows while it is open by forcing the focus back to the "modal" form when the user attempts to select them.

The other solution is to open the "always usable" form in the modal dialog (remembering to close it before calling ShowDialog).

Nasty piece design from a user point of view either way...


这篇关于如何通过显示新表单来阻止特定表单(.showdialog)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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