Currently position my windows form

  • Thread starter Thread starter harry
  • Start date Start date
H

harry

Hi
How can i set Currently position of my window form.
for example:

x = this.Location.X;
y = this.Location.Y;

//(x=199, y =200);
//i want to set my windows form in x(10,20)????

Thanks!!
 
Hi Harry,

I think you need to rephrase your question as I'm not sure what you mean.

You can reposition your form using its Location property

this.Location = new Point(10, 20);

The initial position of your form is controlled by windows unless you specify the StartPosition property to something other than FormStartPosition.WindowsDefaultLocation, for instance FormStartPosition.Manual.
 
You can set the location in the constructor, but if you are using Visual Studio, beware that Location is set inside InitializeComponent so you need to set it after the call to InitializeComponent.
 
Back
Top