From 6c705d028485a364b90e1b9141c05f3e3edfadea Mon Sep 17 00:00:00 2001 From: VolatilePulse Date: Sun, 7 Nov 2021 15:37:42 -0500 Subject: [PATCH] Calculate MaximizedBounds OnMove Closes #277 --- MaterialSkin/Controls/MaterialForm.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/MaterialSkin/Controls/MaterialForm.cs b/MaterialSkin/Controls/MaterialForm.cs index 329bc51e..fc83692c 100644 --- a/MaterialSkin/Controls/MaterialForm.cs +++ b/MaterialSkin/Controls/MaterialForm.cs @@ -411,7 +411,6 @@ private bool Maximized public MaterialForm() { - MaximizedBounds = Screen.GetWorkingArea(Location); DrawerWidth = 200; DrawerIsOpen = false; DrawerShowIconsWhenHidden = false; @@ -853,6 +852,13 @@ protected override void WndProc(ref Message m) } } + protected override void OnMove(EventArgs e) + { + // Empty Point ensures the screen maximizes to the top left of the current screen + MaximizedBounds = new Rectangle(Point.Empty, Screen.GetWorkingArea(Location).Size); + base.OnMove(e); + } + protected override void OnMouseDown(MouseEventArgs e) { if (DesignMode)