相对于 WizardForm 位置的位置自定义表单

Position custom form in relation to WizardForm position

我创建了一个自定义表单来显示选项页面,我试图将其放置在单击选项按钮时 WizardForm 所在位置的中心。我试过下面的代码,但它没有按照描述定位。

[Code]
var
  OptionsWindowForm: TForm;

{ Show the Options window }
procedure ShowOptionsWindow;
begin
  OptionsWindowForm := TForm.Create(nil);
  with OptionsWindowForm do
    begin
      Parent := WizardForm;
      BorderStyle := bsDialog;
      Position := poMainFormCenter;
      ClientWidth := ScaleX(400);
      ClientHeight := ScaleY(140);
      Caption := '{#AppName} Options';
      ShowModal;
    end;
end;

我还为 Position 属性 尝试了 poOwnerFormCenter 并设置了 LeftTop 属性,这些属性似乎被忽略了。

有没有办法按照描述的方式定位它?

好像确实没有达到预期的效果。

虽然这似乎有效:

OptionsWindowForm := TForm.Create(WizardForm); { Make WizardForm the owner }
with OptionsWindowForm do
begin
  Position := poOwnerFormCenter; { Center on the owner }
  { ... }
  ShowModal;
end;