【发布时间】:2009-06-16 07:35:19
【问题描述】:
我有一个有 5 个 MDI 子级的主窗体。创建主窗体时,也会创建并显示 mdi 子窗体。
我在屏幕上为它们分配了不同的位置,但当它们显示时,它们会从默认位置开始,然后以令人不安的方式移动到新位置。我尝试在显示表单之前分配位置,但是在调用 the.Show() 之后,它们往往会转到某个默认位置。 有没有办法避免显示从默认位置到新位置的这种移动?
这是一个代码片段
groupSettingsForm.Show();
groupSettingsForm.Location = new Point(0, 0);
dsForm.Show();
dsForm.Location = new Point(groupSettingsForm.Width, 0);
dPlots.Show();
dPlots.Location = new Point(groupSettingsForm.Width, dsForm.Height);
alertsForm.Show();
alertsForm.Location = new Point(groupSettingsForm.Width, dsForm.Height + dPlots.Height);
dataValuesForm.Show();
dataValuesForm.Location = new Point(0, groupSettingsForm.Height);
我试过了,但它不适合我
groupSettingsForm.Location = new Point(0, 0);
groupSettingsForm.Show();
dsForm.Location = new Point(groupSettingsForm.Width, 0);
dsForm.Show();
dPlots.Location = new Point(groupSettingsForm.Width, dsForm.Height);
dPlots.Show();
alertsForm.Location = new Point(groupSettingsForm.Width, dsForm.Height + dPlots.Height);
alertsForm.Show();
dataValuesForm.Location = new Point(0, groupSettingsForm.Height);
dataValuesForm.Show();
【问题讨论】: