我有一个设置为 Mdi 容器的父表单。我从父表单中的菜单栏单击加载了一个名为 Plot 的子表单。代码是:
protected void menuPlot_Click(object sender, EventArgs e)
{
// ... load form with Plot settings in center of parent form
// ... create a new instance of the Plot settings child form
PlotSettings plotSettings = new PlotSettings();
// ... set Welcome as the parent form for the Plot settings child window
plotSettings.MdiParent = this;
// ... display and position Plot settings child form
plotSettings.StartPosition = FormStartPosition.CenterScreen; // center child form
plotSettings.Show(); // display child form
}
这很好用,除了我有以下问题:
有什么办法可以强制子窗体保持在中心。目前我可以在容器内拖动它。我想阻止用户移动它。此时我能想到的唯一方法就是让孩子无边界,但我不确定这是否可行。
有什么办法可以使子窗体模态?是的,我知道我可以将子表单设为模态,但随后它将不再包含在我想要的父表单中。有没有办法在子窗体处于活动状态时禁用父控件?目前我可以打开子表单的多个实例,但我希望任何时候都只有一个实例。
我在父表单上有一些标签,标签总是位于子表单的顶部。有什么方法可以强制子窗体位于最顶层?我使用了 TopMost,这似乎不起作用。
感谢您提供的任何帮助。