How do i define where to put form (on screen) when it is opened ?

I have button on my form1 which open's form2, but the problem is, that whenever i open form2 it always opens just ON my form1 and i have to drag it somewhere of to be able to see information on form1 while operating in form2

1) How do i specify exact location on screen where i want my form to be opened.
2) I want my form to be opened exactly near my form1 .. so that form 1 right border is coincident with form2 left border. Is it possible




Answer this question

How do i define where to put form (on screen) when it is opened ?

  • Debbie112

    Thanks Andres... this works flawlessly

  • J.Meier

    Mix,

    try the following:

    1) set the StartPosition property of form2 to "Manual"

    2) In the event handler for the click event of the button that opens form2 (in form1) type the following:

    Form2 form2 = new Form2();
    form2 .Location =
    new Point(Location.X + Width, Location.Y);
    form2 .Show();

    The previous code will open the form2 next to form1.

    Andres.


  • tandonk

    Hi Mix....use form1.Location to get information about form1 position in the screen and form1.Size to get information about current size of this form and in the click button function before of  form2.show set location of form2 whit Location properties

    if you want max precision of border coincident use SystemInformation.FrameBorderSize.Width
    to get width of form border size. Sry for my italian english mateTongue Tied

  • How do i define where to put form (on screen) when it is opened ?