Persisting a user’s preference for window sizes in your Windows .Net Application is managed very simply via the applications settings.


void draw()
{
this.Size = new Size(Properties.Settings.Default._Form_Size_Width, Properties.Settings.Default._Form_Size_Height);
}

void _SizeChanged(object sender, EventArgs e)
{
Properties.Settings.Default._Form_Size_Height = this.Size.Height;
Properties.Settings.Default._Form_Size_Width = this.Size.Width;
Properties.Settings.Default.Save();
}

Persisting these choices across revisions requires a little extra code. User settings are saved in the appdata local folder, eg C:\Users\user\AppData\Local\owner\app.exe_Url_xxxxxxxx\w.x.y.z which means with each change to w, x, y or z, the user settings are left behind and a default starting point restarts. To counter that issue, you must port the old settings forward during the application startup:


Properties.Settings.Default.Upgrade();
Properties.Settings.Default.Save();

Related reading:
Client setting FAQ – http://blogs.msdn.com/b/rprabhu/archive/2005/06/29/433979.aspx
MSDN reference for the Settings Upgrade: https://msdn.microsoft.com/en-us/library/system.configuration.applicationsettingsbase.upgrade.aspx