浏览代码

TSetupForm: Don't center inside a hidden or minimized form.

Jordan Russell 8 月之前
父节点
当前提交
e216aae90d
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      Projects/Src/Setup.SetupForm.pas

+ 7 - 0
Projects/Src/Setup.SetupForm.pas

@@ -331,6 +331,13 @@ procedure TSetupForm.CenterInsideControl(const Ctl: TWinControl;
 var
   R: TRect;
 begin
+  const CtlForm = GetParentForm(Ctl);
+  if (CtlForm = nil) or not IsWindowVisible(CtlForm.Handle) or
+     IsIconic(CtlForm.Handle) then begin
+    Center;
+    Exit;
+  end;
+
   if not InsideClientArea then begin
     if GetWindowRect(Ctl.Handle, R) then
       CenterInsideRect(R);