Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Form open on last position closed

I'm trying to have my form start in the same position it was when it last closed.

I've tried setting the 'Start Position' property on the form to 'Manual' and moving/closing/relaunching the application, but I don't see the effect it had.

If set to 'Manual', is there a way to configure it to load on the last position? (It wouldn't be fixed as it could vary)

Other info that might be of help:

-I have multimonitors

-The form does not have a parent

-C# WinForms

-Visual Studio C# 2010 Express

like image 644
EyeSeeSharp Avatar asked Nov 17 '25 19:11

EyeSeeSharp


1 Answers

In the "Properties" window of your form go to "Application Settings". Under "Property Binding" choose and add a new "Location" application setting, name it and save it. Then go to "Events" and add the "FormClosed" event for your form. To save your form's last position call Properties.Settings.Default.Save(); from this event.

If my instructions were not clear enough, try this (and read the second to last comment): https://xldennis.wordpress.com/2010/03/19/preserve-size-and-location-of-windows-forms-part-i/

like image 151
Johnny D Avatar answered Nov 19 '25 10:11

Johnny D



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!