mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-29 13:28:04 +00:00
Fixed Issue 123.
This commit is contained in:
parent
3e65f5bfc2
commit
23a18b8589
@ -100,19 +100,25 @@ namespace OpenHardwareMonitor.GUI {
|
||||
nodeTextBoxMax.DrawText += nodeTextBoxText_DrawText;
|
||||
nodeTextBoxText.EditorShowing += nodeTextBoxText_EditorShowing;
|
||||
|
||||
if (settings.Contains("mainForm.Location.X")) {
|
||||
int x = settings.GetValue("mainForm.Location.X", Location.X);
|
||||
x = x < 0 ? 0 : x;
|
||||
int y = settings.GetValue("mainForm.Location.Y", Location.Y);
|
||||
y = y < 0 ? 0 : y;
|
||||
this.Location = new Point(x, y);
|
||||
} else {
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
}
|
||||
Rectangle newBounds = new Rectangle {
|
||||
X = settings.GetValue("mainForm.Location.X", Location.X),
|
||||
Y = settings.GetValue("mainForm.Location.Y", Location.Y),
|
||||
Width = settings.GetValue("mainForm.Width", 470),
|
||||
Height = settings.GetValue("mainForm.Height", 640)
|
||||
};
|
||||
|
||||
ClientSize = new Size(
|
||||
settings.GetValue("mainForm.Width", 470),
|
||||
settings.GetValue("mainForm.Height", 640));
|
||||
Screen[] screens = Screen.AllScreens;
|
||||
Rectangle totalWorkingArea = new Rectangle(int.MaxValue, int.MaxValue,
|
||||
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)
|
||||
column.Width = Math.Max(20, Math.Min(400,
|
||||
|
Loading…
x
Reference in New Issue
Block a user