public static Point ScreenCentered(this Size size)
        {
            Rectangle bounds = Screen.PrimaryScreen.WorkingArea;

            return(new Point(
                       (bounds.Width - SettingsExtension.ApplyLimitations(size.Width, 0, bounds.Width)) / 2,
                       (bounds.Height - SettingsExtension.ApplyLimitations(size.Height, 0, bounds.Height)) / 2
                       ));
        }
 public static Int32 StringToInteger(this String value, Int32 lower, Int32 upper, Int32 standard)
 {
     if (Int32.TryParse(value, out Int32 result))
     {
         return(SettingsExtension.ApplyLimitations(result, lower, upper));
     }
     else
     {
         return(standard);
     }
 }
        public static Rectangle StandardBounds(this Form form, Size suggestion)
        {
            if (form == null)
            {
                throw new ArgumentNullException();
            }

            Size      minimumSize = form.MinimumSize;
            Size      currentSize = suggestion;
            Rectangle workingArea = Screen.PrimaryScreen.WorkingArea;

            Int32 w = SettingsExtension.ApplyLimitations(currentSize.Width, minimumSize.Width, workingArea.Width);
            Int32 h = SettingsExtension.ApplyLimitations(currentSize.Height, minimumSize.Height, workingArea.Height);

            Size  s = new Size(w, h);
            Point p = SettingsExtension.ScreenCentered(s);

            return(new Rectangle(p, s));
        }