如何使子窗口和父窗口在Windows应用程序中处于活动状态? [英] How to make child and parent window active in windows application?

查看:60
本文介绍了如何使子窗口和父窗口在Windows应用程序中处于活动状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在Windows应用程序上工作.
我基本上有两个窗户.
当我打开子窗口时,我无法访问主窗口.
我想同时访问子窗口和主窗口.
它应该是活动的.
该怎么做?


问候
Froxy

Hi
I am working on windows application.
I have two windows basically.
when i open the child window,I am not able to access the main window.
I want to access both the child window and main window at time.
It should be active.
How to do that?


Regards
Froxy

推荐答案

您可以使用以下方法启用父窗口:
You can enable the parent window using this:
private void Form_Activated(object sender, System.EventArgs e)
{
    if (this.Owner != null)
    {
        this.Owner.Enabled = true;
    }
}


或使用以下代码打开您的表单:


Or use the following code to open your form:

Form newForm = new ChildForm();
newForm.Show(this);





--Amit





--Amit


访问是什么意思?从用户角度或程序员角度访问对话框.

无论如何,从用户角度考虑,似乎您已经创建了模型"对话框.您必须为此创建无模式对话框.

通过 [
What do you mean by access ? Accessing the dialog as a user perspective or programmer perspective.

Anyway, considering from user perspective, it seems that you''ve created the Model dialog. You''ve to create Modeless dialog for that.

Go through this[^] article.


这篇关于如何使子窗口和父窗口在Windows应用程序中处于活动状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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