namespace OpenNest.Desktop; /// /// Sizing shared by the large browse dialogs (File > Open, Drawing Library, Shape Library) so /// they open at the same size: a normal window nine tenths of the owner screen's working area, /// centered in it so its bottom row stays clear of the taskbar. /// public static class LargeDialogBounds { /// /// The bounds in (screen pixels), never smaller than the /// dialog's minimum size and never starting left of or above the working area. /// public static PixelRect Centered(PixelRect workingArea, int minimumWidth, int minimumHeight) { var width = System.Math.Max(minimumWidth, workingArea.Width * 9 / 10); var height = System.Math.Max(minimumHeight, workingArea.Height * 9 / 10); return new PixelRect( System.Math.Max(workingArea.X, workingArea.X + (workingArea.Width - width) / 2), System.Math.Max(workingArea.Y, workingArea.Y + (workingArea.Height - height) / 2), width, height); } }