Link to home
Start Free TrialLog in
Avatar of ba272
ba272

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Chester_M_Ragel
Chester_M_Ragel

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RomanPetrenko
RomanPetrenko

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