showdialog.dispose 焦点到另一个打开的应用程序 [英] showdialog.dispose focus to another open application

查看:28
本文介绍了showdialog.dispose 焦点到另一个打开的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在处理 showdialog 表单时遇到了 showdialog 问题.应用程序焦点到在任务栏中打开的另一个程序.如果什么都没有打开,那么它会聚焦到桌面.

I have a problem with showdialog when the showdialog form is being disposed. The Application focus to another program opened in taskbar. if nothing is opened then it focused to desktop.

推荐答案

当对话框过早处理时会发生这种情况.所有窗口都被对话框禁用,因此 Windows 无法将焦点集中在其中任何一个上,而必须选择另一个应用程序的窗口.确保使用带有 Using 关键字的标准模式,以便对话框对象在 关闭后被释放:

This will happen when the dialog is getting disposed too early. All of the windows are disabled by the dialog so Windows can't keep the focus on any of them and has to pick the window of another app. Make sure you use the standard pattern with the Using keyword so the dialog object is disposed after it closes:

    Using dlg As New FooDialog
        If dlg.ShowDialog(Me) = DialogResult.OK Then
            '' Use dlg properties
            ''
        End If
    End Using

这篇关于showdialog.dispose 焦点到另一个打开的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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