简体   繁体   English

子MDI表单显示在父MDI控件下方

[英]Child MDI Form appears below the parent MDI control

I have 2 Forms; 我有2种表格; Form1 and Form2. Form1和Form2。 In Form1, there's a MenuStrip and a button. 在Form1中,有一个MenuStrip和一个按钮。 When I click the button, Form2 appears below the Form1 button. 当我单击按钮时,Form2出现在Form1按钮下方。

private void button1_Click(object sender, EventArgs e)
{
    Form2 frm = new Form2();
    frm.MdiParent = this;
    frm.StartPosition = FormStartPosition.CenterScreen;
    frm.WindowState = FormWindowState.Maximized;
    frm.Show();
}

Child forms in an MDI container always underlay other controls that are directly placed on the MDI container: MDI容器中的子窗体始终是直接放置在MDI容器上的其他控件的基础:

在此处输入图片说明

You'll see the same behavior if you move the Form underneath your menu too, although since the MenuStrip is docked, you should see scroll bars that allow you to view the entire Form. 如果也将Form移到菜单下方,您也会看到相同的行为,尽管由于MenuStrip已停靠,您应该会看到滚动条,可让您查看整个Form。

在此处输入图片说明

Either merge your button onto the MenuStrip: 将您的按钮合并到MenuStrip上:

在此处输入图片说明

Or dock it to an edge somewhere: (this looks ridiculous, but it's just to demonstrate; you could dock a panel and move it in there, or play around with a ToolStrip, for example) 或将其停靠在某个地方的边缘:( 这看起来很荒谬,但这只是为了演示;您可以停靠一个面板并将其移到其中,或者例如使用ToolStrip玩耍)

在此处输入图片说明

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

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