Skip to content

Commit

Permalink
Merge pull request hexagon-oss#21 from frutiger/persist-splitter-dist…
Browse files Browse the repository at this point in the history
…ance
  • Loading branch information
pgrawehr authored Dec 20, 2021
2 parents 072fa6d + fdc8234 commit 558a14b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions OpenHardwareMonitor/GUI/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,23 @@ private void MainForm_Load(object sender, EventArgs e) {

// Register for receiving hardware change information (trough WndProc)
DeviceNotification.RegisterDeviceNotification(Handle);

// This setting needs to be applied after the form load since it otherwise triggers
// a relayout.
if (this.settings.Contains("splitContainer.SplitterDistance")) {
this.splitContainer.SplitterDistance = this.settings.GetValue("splitContainer.SplitterDistance", 0);
}

// This event needs to be attached after the form load since it otherwise
// triggers a relayout.
this.splitContainer.SplitterMoved += delegate (object splitterSender,
SplitterEventArgs splitterEvent) {
if (this.settings.GetValue("plotLocation", 0) == 1) {
this.settings.SetValue("splitContainer.SplitterDistance", splitterEvent.SplitY);
} else if (this.settings.GetValue("plotLocation", 0) == 2) {
this.settings.SetValue("splitContainer.SplitterDistance", splitterEvent.SplitX);
}
};
}

private void MainForm_FormClosed(object sender, FormClosedEventArgs e) {
Expand Down

0 comments on commit 558a14b

Please sign in to comment.