GetOptimalWindowSize - bound by available screen space

Limiting by working area size was not good enough - having whole chrome on screen is important.
This commit is contained in:
Killy 2020-04-27 01:23:23 +03:00
parent 95c759e3fd
commit ec2c46daa8

View file

@ -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;