ALT +在模式对话框上显示 MessageBox 后 TAB 不起作用

发布于 2024-08-04 13:23:39 字数 1055 浏览 2 评论 0原文

在模式对话框上显示 MessageBox 后,ALT + TAB 不起作用...

我在一个解决方案文件下有三个项目(P1、P2 和 P3)。 P1包含P1Form.cs,P2包含P2Form.cs。

这些文件的详细信息如下:

P1Form.cs 包含一个按钮,该按钮通过 MessageBox.Show() 方法显示消息框。 P2Form.cs 包含一个按钮,用于显示 MessageBox.Show() 方法中的消息框。

项目P3包含3个表格Form_A、Form_B和Form_C。 Form_A 是 MDI 容器,有一个按钮可打开 Form_B 作为其子窗体。 Form_B 还有一个按钮,可以通过 ShowDialog() 方法将 Form_C 作为模式对话框打开。

Form_C 继承自 P2Form.cs,P2Form.cs 继承自 P1Form.cs。 Form_A.cs 是主表单,将是申请的第一个表单。

重现所需问题的步骤:

  1. 打开 Form_A(MDI) 容器
  2. 单击按钮将打开 Form_B
  3. 再次单击 Form_B 上的按钮 这将打开 Form_C 将有两个按钮(两个按钮都来自基类 P1Form.cs 和 P2Form.cs)
  4. 单击 Form_C 的任意按钮 将打开消息框。

问题: 现在通过 Alt + Tab 切换窗口。您将无法在切换窗口中看到当前窗口图标。

我尝试过的替代选项...

  1. 如果我使用 Form.show() 而不是 Form.ShowDialog,那么它可以正常工作。
  2. 如果我在当前类中编写所有 messageBox 代码而不是在基类中编写,那么它可以正常工作。

谁能建议我如何在不执行我已经尝试过的上述替代方案的情况下解决这个问题?

ALT + TAB is not working after displaying MessageBox on modal dialog...

I've three projects (P1, P2 and P3) under one solution file. P1 contains P1Form.cs, P2 contains P2Form.cs.

Detail of these files are as follow:

P1Form.cs contains one button which shows the Message box from MessageBox.Show() method.
P2Form.cs contains one button which shows the Message box from MessageBox.Show() method.

Project P3 contains 3 forms Form_A, Form_B and Form_C.
Form_A is the MDI container and has one button which opens the Form_B as its child form. Form_B has also one button which open the Form_C as modal dialog from ShowDialog() method.

Form_C is inherited from P2Form.cs and P2Form.cs is inherited from P1Form.cs.
Form_A.cs is the Main form which will be the first form for application.

Steps to Reproduce desired issue:

  1. Open the Form_A which is the MDI
    Container
  2. Click on button which will open the
    Form_B
  3. Again click the button on the Form_B
    which will open the Form_C which
    will be having two buttons (both buttons are from base classes P1Form.cs and P2Form.cs)
  4. Click the any button of Form_C which
    will open the message box.

Issue:
Now switch the window through Alt + Tab. You will not be able to see the current windows icon on switching window.

Alternative options which I tried...

  1. If I use Form.show() instead of Form.ShowDialog, then it works fine.
  2. If I write all messageBox coding in current class instead of writing in base class, then it works fine.

Can anyone suggest me how can I resolve this issue without doing both above mentioned alternatives which I had already tried?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

诗笺 2024-08-11 13:23:39

尝试设置从 Form_B(父)到 Form_C(子)的父子关系:

Form_C f = new Form_C();
f.ShowDialog(this);

Try setting up a parent-child relationship from Form_B (parent) to Form_C (child):

Form_C f = new Form_C();
f.ShowDialog(this);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文