How do I control a child dialog's initial location?

Would someone be so kind as to tell me how, using C#, I can specify that a dialog will be drawn at the same location each time it's opened, which would require me to disable the cascading window default, where each new window is in front of and a little lower than the one opened before it?


Thanks,
RA
ba272Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chester_M_RagelCommented:
For forms, there is a property called StartPosition. If you have a perticular location where you want to show the form, set that to manual and set the location property of the form to something where you want to show that. Or if you always want to show that in the center of the screen, or center of the parent you can select the correct property from the form property(StartPosition).
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RomanPetrenkoCommented:
Chester_M_Ragel absolutely right, just little sample code:

// Shows dialog in desired location
private void ShowChildForm(Point DesiredLocation)
{
      ChildDialogForm f = new ChildDialogForm();
      f.StartPosition = FormStartPosition.Manual;
      f.Location = DesiredLocation;
      f.ShowDialog(this);
}
//Sample: how to call
private void button1_Click(object sender, System.EventArgs e)
{
      ShowChildForm(new Point(10,10));
}
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.