Reputation: 780
I have set the start position to manual somewhere around the top right of the screen in VS2012. I am trying to later on set this window in the center with one click but no matter what I do its never in the center.. how can I do that?
Upvotes: 2
Views: 1325
Reputation: 8902
Just add this code to your button click event,
this.Location = new Point((SystemInformation.PrimaryMonitorSize.Width - this.Width) / 2, (SystemInformation.PrimaryMonitorSize.Height - this.Height) / 2);
Upvotes: 3