Fix form centering to non-primary screen

The first screen is configured with origin coordinates 0,0; any other screens that are arranged to the left or below will have coordinates in the negative. Negative coordinates are valid; don't sanitize.
This commit is contained in:
Kurt
2025-01-03 13:35:54 -06:00
parent a1a15fe5b2
commit 674a778bf9

View File

@@ -27,7 +27,7 @@ internal static void CenterToForm(this Control child, Control? parent)
return;
int x = parent.Location.X + ((parent.Width - child.Width) / 2);
int y = parent.Location.Y + ((parent.Height - child.Height) / 2);
child.Location = new Point(Math.Max(x, 0), Math.Max(y, 0));
child.Location = new Point(x, y);
}
/// <summary>