我知道这个问题自从之前(例如Best way to show customized message dialogs),但我仍然没有找到我想要的东西。按钮的自定义标题的通用对话框
我开始是这样的:
class function TAttracsForm.MessageDlg(const aMsg: string; aDlgType: TMsgDlgType; Buttons: TMsgDlgButtons; aCaptions: array of String; aDefault: TMsgDlgBtn): TModalResult;
var
vDlg: TForm;
i: Integer;
begin
if aButtons.Count = aCaptions.Count then
begin
vDlg := CreateMessageDialog(aMsg, aDlgType, Buttons);
try
for i := 0 aCaptions.Count - 1 do
TButton(vDlg.FindComponent(Buttons[i].Caption)).Caption := aCaptions[i];
vDlg.Position := poDefaultPosOnly;
Result := vDlg.ShowModal;
finally
vDlg.Free;
end;
end;
end;
和呼叫会是什么样子:
if (MessageDlg('Really quit application ?', mtWarning,
[mbNo, mbCancel, mbYes], {'No save', 'Cancel', 'Save'}) = mrYes) then
但当然,上面的代码不进行编译。我不知道如何在循环中获取一个集合中的一个项目,以及如何在开始时获得它的总数。
也许你可以使用TTaskDialog或前Vist之一有能力的模拟。 – 2011-03-24 10:56:38
+1我同意Vista任务对话框是可用的方式。 – 2011-03-24 11:08:19
我的应用程序只在XP和Server 2003 R2上运行,所以我不能使用TTaskDialog。 – 2011-03-24 12:15:41