如何使子窗口和父窗口在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.