Title: Center a form on the screen at run time in C#
You can center a form at design time by setting its StartPosition property to CenterScreen. Note that you cannot do this in the form's Load event handler because the form's position is already set when that event handler executes. You can do it in the form's constructor, but it's usually considered bad style to modify the constructor.
To center the form at design time, either in the Load event handler or in some other part of the program, you need another approach to center a form. You could use the size of the form, the size of the screen, and the location and size of the task bar to figure out where to move the form to center it. Fortunately there's a much easier way to center a form. Simply invoke the form's CenterToScreen method as in the following code.
Sometimes things are a lot easier than you might think, at least if you know what method to use.
Download the example to experiment with it and to see additional details.