MDIChild表单依赖于此.Enabled = false; [英] MDIChild Form drops to back on this.Enabled = false;

查看:85
本文介绍了MDIChild表单依赖于此.Enabled = false;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MDI应用程序。

I have a MDI app.

当我从SQL Server获取数据时,它有时运行有点慢,所以我做了

When I fetch the data from SQL Server, it sometimes runs a bit slow, so I do a

this.Enabled = false;

在MDI子表单上(如Intelliense所说)设置控件不回应用户互动。  当这一行命中时,如果有另一个mdi子窗口打开,它会弹出到前面。

on the MDI child form to (as Intelliense says) set the control not to respond to user interaction.  When this line hits, if there is another mdi child window open, it pops to the front.

这通常没问题,我可以添加一个......

This would normally be fine, I can just add a...

this.BringToFront();

...重新启用表单后,但

...after the form is re-enabled, BUT

我正在使用FormEnter处理程序在重新输入表单时提示用户。  这样做的效果是......

I am using a FormEnter handler to prompt the user when re-entering the form.  The effect of this is...

Form1上的用户点击搜索。  表格灰显,Form2明显弹出顶部,Form1弹出,并提示用户刷新屏幕数据。

User on Form1, hits Search.  Form grays out, Form2 breifly pops to the top, Form1 pops up, and the user gets prompted to refresh data for the screen.

我的问题:

我该如何...


  1. 禁用整个表单,以便用户在搜索过程中停止尝试,或者
  2. 使 .Enabled 按照宣传的方式工作,而无需任何人想要的额外工件或要求。 
  1. disable the entire form so the user stops trying things during a search, or
  2. make .Enabled work as advertised without an extra artifact no one ever wanted or asked for. 

我宁愿生活在虚假的希望而不是虚伪的绝望中。

I'd rather live with false hope than with false despair.

推荐答案

更新:我暂时解决了这个问题,使用布尔开关在这种情况下禁用弹出窗口。  但我仍然认为将表单设置为.Enabled = false;永远不要修改它的Z顺序。

Update: I have momentarily solved this using a boolean switch to disable the pop-up in this one case.  But I still think that setting a form to .Enabled = false; should never modify its Z order.


这篇关于MDIChild表单依赖于此.Enabled = false;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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