Fixed Issue 123.

This commit is contained in:
Paul Werelds 2010-10-05 19:34:59 +00:00
parent 3e65f5bfc2
commit 23a18b8589

View File

@ -100,19 +100,25 @@ namespace OpenHardwareMonitor.GUI {
nodeTextBoxMax.DrawText += nodeTextBoxText_DrawText; nodeTextBoxMax.DrawText += nodeTextBoxText_DrawText;
nodeTextBoxText.EditorShowing += nodeTextBoxText_EditorShowing; nodeTextBoxText.EditorShowing += nodeTextBoxText_EditorShowing;
if (settings.Contains("mainForm.Location.X")) { Rectangle newBounds = new Rectangle {
int x = settings.GetValue("mainForm.Location.X", Location.X); X = settings.GetValue("mainForm.Location.X", Location.X),
x = x < 0 ? 0 : x; Y = settings.GetValue("mainForm.Location.Y", Location.Y),
int y = settings.GetValue("mainForm.Location.Y", Location.Y); Width = settings.GetValue("mainForm.Width", 470),
y = y < 0 ? 0 : y; Height = settings.GetValue("mainForm.Height", 640)
this.Location = new Point(x, y); };
} else {
StartPosition = FormStartPosition.CenterScreen;
}
ClientSize = new Size( Screen[] screens = Screen.AllScreens;
settings.GetValue("mainForm.Width", 470), Rectangle totalWorkingArea = new Rectangle(int.MaxValue, int.MaxValue,
settings.GetValue("mainForm.Height", 640)); int.MinValue, int.MinValue);
foreach(Screen screen in screens)
totalWorkingArea = Rectangle.Union(totalWorkingArea, screen.Bounds);
this.Bounds = newBounds;
if (!totalWorkingArea.Contains(newBounds) ||
!settings.Contains("mainForm.Location.X"))
this.StartPosition = FormStartPosition.CenterScreen;
foreach (TreeColumn column in treeView.Columns) foreach (TreeColumn column in treeView.Columns)
column.Width = Math.Max(20, Math.Min(400, column.Width = Math.Max(20, Math.Min(400,