简体   繁体   English

当子窗体处于活动状态时,如何编辑父窗体?

[英]How to edit the parent Form when a child Form is active?

When I open a child Form, I need the parent Form to remain accessible. 当我打开一个子窗体时,我需要父窗体保持可访问性。
For example, I could type in a text field. 例如,我可以输入一个文本字段。

You should use user controls for this type of functionality. 您应将用户控件用于此类功能。

by using user controls you can use single form with multiple user controls at a time. 通过使用用户控件,您可以一次将单个表单与多个用户控件一起使用。

to know how user control works: watch this video 了解用户控制的工作原理: 观看此视频

OR 要么

by using show(), Hide(), BringToFront() and SendToBack() you can do but it will add complexity to your code. 通过使用show(),Hide(),BringToFront()和SendToBack(),您可以执行此操作,但这会增加代码的复杂性。

You can open it by Show, but maybe set original form as owner, so that it does not move to background. 您可以通过Show打开它,但可以将原始表单设置为所有者,这样它就不会移到后台。

        var f2 = new Form2();
        f2.Owner = this;
        f2.Show();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM