Form positionning top left

  • Thread starter Thread starter Marty
  • Start date Start date
M

Marty

Hi,

When creating a form, how can we set its property .left and .top to be
handled when the form is showed. Because, if I first assign values to
..left and .top, and secondly I call .show(), then the form does not
display at the correct screen location.

ex:
System.windows.forms.form myForm = new System.windows.forms.form();
myForm.left = 200;
myForm.top = 200;
myForm.show();
//The form does NOT appear at specified screen coordinate.

ex:
System.windows.forms.form myForm = new System.windows.forms.form();
myForm.show();
myForm.left = 200;
myForm.top = 200;
//The form does appear at specified screen coordinate and the user can
see the form's initial position, then reappear to the .left and .top
coordinate.

Any idea?

Thank you,
Marty
 
Here are some things to check:

1. Ensure that the "StartPosition" property of the form is set to "Manual".

2. You didn't say wehre you have this code. If it's in Form_Load and not
working then try placing into the constructor instead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top