I had a similar situation recently.
I was attempting something similar but by controlling the Child Forms from a different class.
Note(s):
You re trying to set the Child Form(s) "TopMost" to something that does not allow it.
In this case the "MdiContainer".
<强> 要完成此任务: 强>
• 禁用主形式“是Mdicontainer”财产(该财产的使用还是过时的)。
• 将表单顶部属性设置为真实。
• 你现在应该能够完成你的特点。
**Code Example:**
/* On your Main Form Class */
private void btnSystem_Click(object sender, EventArgs e)
{
// Instantiate the Form_EnterPassword by passing the MainForm
Form_EnterPassword EP = new Form_EnterPassword(this);
EP.Show(); // No longer as modal Form to display in front.
}
/* Under your EnterPassword Form Class */
// Do not create a new Instance of MyMainForm.
// You want to use the same thread as your MainForm
private MyMainForm mainForm;
/* Constructor */
public Form_EnterPassword(MyMainForm form)
{
mainForm = form;
this.Owner = mainForm; // "this" refers to the: EnterPassword Form.
}
Remarks:
The only additional thing that you (may) have to do, (to achieve perfection) is to check the MainForm > WindowState; and create a code block to minimize or bring the Forms to their specific state.
<强 > e: 强>
if (WindowState == FormWindowState.Minimized)
{ /* Code to Minimize all the Child Forms. */ }
else { /* Code to bring all Forms to their "Normal" State */ }