diff options
Diffstat (limited to 'grapher/Form1.cs')
| -rw-r--r-- | grapher/Form1.cs | 17 |
1 files changed, 13 insertions, 4 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 |