diff options
| author | a1xd <[email protected]> | 2021-01-21 22:54:30 -0500 |
|---|---|---|
| committer | a1xd <[email protected]> | 2021-01-21 22:54:30 -0500 |
| commit | d5316b36a285287a3e02a1c568c4b66f02c23c7b (patch) | |
| tree | 5a5177845b4f7bf3073474ec98ecaed88d54411c | |
| parent | update signed (diff) | |
| download | rawaccel-d5316b36a285287a3e02a1c568c4b66f02c23c7b.tar.xz rawaccel-d5316b36a285287a3e02a1c568c4b66f02c23c7b.zip | |
center gui on initial resize
position is no longer based on the Form.Location property, should fix issues with multi-monitor setups
| -rw-r--r-- | grapher/Form1.cs | 17 | ||||
| -rw-r--r-- | grapher/Models/AccelGUI.cs | 1 |
2 files changed, 13 insertions, 5 deletions
diff --git a/grapher/Form1.cs b/grapher/Form1.cs index 71a5e01..6927211 100644 --- a/grapher/Form1.cs +++ b/grapher/Form1.cs @@ -160,6 +160,8 @@ namespace grapher DirectionalityRangeLabel, RangeActiveValueX, RangeActiveValueY); + + ResizeAndCenter(); } #endregion Constructor @@ -191,18 +193,25 @@ namespace grapher chartsPanel.AutoScrollPosition = Constants.Origin; } - public void DoResize() + public void ResizeAndCenter() { ResetAutoScroll(); - var workingArea = Screen.PrimaryScreen.WorkingArea; + var workingArea = Screen.FromControl(this).WorkingArea; var chartsPreferredSize = chartsPanel.GetPreferredSize(Constants.MaxSize); Size = new Size { - Width = Math.Min(workingArea.Width - Location.X, optionsPanel.Size.Width + chartsPreferredSize.Width), - Height = Math.Min(workingArea.Height - Location.Y, chartsPreferredSize.Height + 48) + Width = Math.Min(workingArea.Width, optionsPanel.Size.Width + chartsPreferredSize.Width), + Height = Math.Min(workingArea.Height, chartsPreferredSize.Height + 48) }; + + Location = new Point + { + X = workingArea.X + (workingArea.Width - Size.Width) / 2, + Y = workingArea.Y + (workingArea.Height - Size.Height) / 2 + }; + } #endregion Method diff --git a/grapher/Models/AccelGUI.cs b/grapher/Models/AccelGUI.cs index 4dd7caa..a0d3aa8 100644 --- a/grapher/Models/AccelGUI.cs +++ b/grapher/Models/AccelGUI.cs @@ -71,7 +71,6 @@ namespace grapher } SetupButtons(); - AccelForm.DoResize(); // TODO: The below removes an overlapping form from the anisotropy panel. // Figure out why and remove the overlap and below. |