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

Posted on 2004-11-11
Last Modified: 2010-04-15
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?

Question by:ba272
    LVL 6

    Accepted Solution

    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).
    LVL 8

    Expert Comment

    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;
    //Sample: how to call
    private void button1_Click(object sender, System.EventArgs e)
          ShowChildForm(new Point(10,10));

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    This video discusses moving either the default database or any database to a new volume.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now