Total .NET Analyzer Rule Documentation  

FormLocation Rule

Use the StartPosition in place of specific location property to set form location.

Remarks

You should not depend on the form's Location property (which sets the coordinates of the upper left corner of a form) to set your form's position at runtime. If you use the Location property, the form's location on the screen will vary depending on the user's system; screen size and resolution may cause a form's location to change unpredictably. Instead of depending on the location property, consider allowing Windows to determine the position of the form on the screen by setting the form's StartPosition property to 'WindowsDefaultLocation' or 'CenterScreen'.

Resolution

Set the form's StartPosition property through the Windows Form Designer window. To allow Windows to determine the best location based on the user's system, set the property to 'WindowsDefaultLocation'. To center the form on the screen, set the property to 'CenterScreen'.

See Also

Setting the Screen Location of Windows Forms

Form.StartPosition Property

Control.Location Property