Pergunta

Eu tenho um formulário principal que tem 5 MDI filhos. Quando o formulário principal é criado, os filhos MDI são criados e apresentados bem.

I atribuir-lhes diferentes locais na tela, mas quando eles são mostrados eles começam com o local padrão e movimento de uma forma preocupante para os novos locais. Tentei atribuir o local antes de eu mostrar as formas, mas como seria de esperar depois de chamar the.Show () eles tendem a ir para algum local padrão. Existe uma maneira de evitar mostrar esse movimento a partir do padrão para as novas localizações?

Aqui está um fragmento de código

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);

Eu tentei isso, mas não funcionou para mim

   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();
Foi útil?

Solução

Eu só tinha algo semelhante a isto - minha pergunta pode ser encontrada aqui .

Você precisa definir a propriedade StartPosition para FormStartPosition.Manual:

form.StartPosition = FormStartPosition.Manual;
form.Location = new System.Drawing.Point(0, 0);
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top