Fixed a problem, where the MainForm location and size was lost when the application is started minimized and exited without ever showing the form. This caused MainForm_Load to be never called (location and size was not loaded), but the default size and location were still saved. The new implementation only saves the location and size when one of the two is changed.

This commit is contained in:
Michael Möller
2010-11-11 21:22:24 +00:00
parent d9dc0f5b45
commit 7ee8cea14e
2 changed files with 11 additions and 7 deletions

View File

@@ -338,13 +338,6 @@ namespace OpenHardwareMonitor.GUI {
}
private void SaveConfiguration() {
if (WindowState != FormWindowState.Minimized) {
settings.SetValue("mainForm.Location.X", Bounds.X);
settings.SetValue("mainForm.Location.Y", Bounds.Y);
settings.SetValue("mainForm.Width", Bounds.Width);
settings.SetValue("mainForm.Height", Bounds.Height);
}
foreach (TreeColumn column in treeView.Columns)
settings.SetValue("treeView.Columns." + column.Header + ".Width",
column.Width);
@@ -559,5 +552,14 @@ namespace OpenHardwareMonitor.GUI {
sensor.ResetMax();
}));
}
private void MainForm_MoveOrResize(object sender, EventArgs e) {
if (WindowState != FormWindowState.Minimized) {
settings.SetValue("mainForm.Location.X", Bounds.X);
settings.SetValue("mainForm.Location.Y", Bounds.Y);
settings.SetValue("mainForm.Width", Bounds.Width);
settings.SetValue("mainForm.Height", Bounds.Height);
}
}
}
}