2009-06-16 7 views
1

J'ai une forme principale qui a 5 enfants MDI. Lorsque le formulaire principal est créé, les enfants mdi sont créés et affichés également.MDI Child.show() affiche le formulaire d'une manière étrange

Je leur assigne différents emplacements à l'écran, mais quand ils sont affichés, ils commencent par l'emplacement par défaut et se déplacent d'une manière troublante vers les nouveaux emplacements. J'ai essayé d'assigner l'emplacement avant que je montre les formes, mais comme prévu après avoir appelé the.Show() ils tendent à aller à un emplacement par défaut. Y a-t-il une manière d'éviter d'afficher ce mouvement de la valeur par défaut aux nouveaux emplacements?

Voici un fragment de code

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

J'ai essayé, mais ça n'a pas marché pour moi

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

Répondre

1

Je viens d'avoir quelque chose de similaire à ce - my question can be found here.

Vous devez définir la propriété StartPosition-FormStartPosition.Manual:

form.StartPosition = FormStartPosition.Manual; 
form.Location = new System.Drawing.Point(0, 0); 
Questions connexes