From ec2c46daa852d5692bf891ca1700ac6c267abfd3 Mon Sep 17 00:00:00 2001 From: Killy Date: Mon, 27 Apr 2020 01:23:23 +0300 Subject: [PATCH] GetOptimalWindowSize - bound by available screen space Limiting by working area size was not good enough - having whole chrome on screen is important. --- Greenshot/Forms/ImageEditorForm.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Greenshot/Forms/ImageEditorForm.cs b/Greenshot/Forms/ImageEditorForm.cs index 3396acd15..4609ff4a8 100644 --- a/Greenshot/Forms/ImageEditorForm.cs +++ b/Greenshot/Forms/ImageEditorForm.cs @@ -1502,10 +1502,9 @@ namespace Greenshot { var newHeight = chromeSize.Height + surfaceSize.Height; // Upper bound. Don't make it bigger than the available working area. - var screen = Screen.FromControl(this); - var workingArea = screen.WorkingArea; - newWidth = Math.Min(newWidth, workingArea.Width); - newHeight = Math.Min(newHeight, workingArea.Height); + var maxWindowSize = GetAvailableScreenSpace(); + newWidth = Math.Min(newWidth, maxWindowSize.Width); + newHeight = Math.Min(newHeight, maxWindowSize.Height); // Lower bound. Don't make it smaller than a fixed value. int minimumFormWidth = 650;