private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
Properties.Settings.Default.WindowState = WindowState;
if (WindowState == FormWindowState.Normal)
{
Properties.Settings.Default.WindowSize = Size;
Properties.Settings.Default.WindowLocation = Location;
}
else
{
Properties.Settings.Default.WindowSize = RestoreBounds.Size;
Properties.Settings.Default.WindowLocation = RestoreBounds.Location;
}
Properties.Settings.Default.Save();
}