internal static bool TrySetFormBoundsToMatchParent(Form form, IntPtr parentHandle) { Rectangle parentBounds; if (!USER32.GetClientRect(parentHandle, out parentBounds)) { return(false); } form.Bounds = parentBounds; return(true); }