How to set the Screen Location of Windows Forms in C#

 
You can specify where a form is to be displayed on the computer screen by entering values in the Location property. You can set position, in pixels, of the top-left corner of the form. Also, you need to set the StartPosition property to indicate the boundaries of the display area. The default start position is ‘WindowsDefaultLocation

We can specify the initial position of a form with the help of Startposition property.
You can use ‘Startposition’ property with ‘FormStartPosition’ Enumeration, that has following members

DescriptionDisplay Help
ManualThe position of the form is determined by the Location property.
CenterScreenThe form is centered on the current display, and has the dimensions specified in the form’s size.
WindowsDefaultLocationThe form is positioned at the Windows default location and has the dimensions specified in the form’s size.
WindowsDefaultBoundsThe form is positioned at the Windows default location and has the bounds determined by Windows default.
CenterParentThe form is centered within the bounds of its parent form.

You can set the location of the windows form using the Properties window,follow these steps:
1. Set the form’s StartPosition property to Manual.
2. Type the values for the Location property, separated by a comma, to position the form, where the first number (X) is the distance from the left border of the display area and second number (Y) is the distance from the upper border of the display area.

Now if you want to set the location pragmatically ten use this code sample :
[VB.Net]

Form1.Location = New Point(100, 100)

[C#]

Form1.Location = new Point(100, 100);

or you can set the location with the help of Top and left property of the windows form means change the X coordinate or Y coordinate of the form’s location using the Left property (for the X coordinate) and the Top property (for the Y coordinate) like as :
[VB.Net]

Form1.Left = 200

[C#]

Form1.Left = 200;

Author: Hirendra Sisodiya

Programmer at PSPL. Can be found on Google Plus.