我希望MessageDlg显示在其父窗体的中心.有关如何在Delphi 2010中完成此任务的任何建议?
我在这里找到了以下代码:http://delphi.about.com/od/formsdialogs/l/aa010304a.htm但它对我不起作用.弹出窗口仍然不以所有者表单为中心.(我不清楚该方法实际上如何知道所有者形式......)
function TForm1.MessageDlg(const Msg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; HelpCtx: Integer): Integer;
begin
with CreateMessageDialog(Msg, DlgType, Buttons) do
try
Position := poOwnerFormCenter;
Result := ShowModal
finally
Free
end
end;
Run Code Online (Sandbox Code Playgroud)