我想在消息框中更改YESNO按钮的文本。

CModalWndManager::ShowMessageBox(AnsiString::LoadStr(IDS_NOT_SUPPORTED).c_str(), mtWarning, TMsgDlgButtons() << mbYes << mbNo, mbOK == mrYes);


我需要YES而不是"Switch Mode",对于NO我要"Exit"

在RAD Studio XE中可以这样做吗?

最佳答案

http://bcbjournal.org/articles/vol4/0003/Making_marvelous_message_dialogs.htm

TForm* Dlg = CreateMessageDialog(
    "Purge Warp Core?", mtConfirmation,
    TMsgDlgButtons() << mbYes << mbNo);
  TButton* yb = dynamic_cast<TButton *>
    (Dlg->FindComponent("Yes"));
  if (yb)
    yb->Caption = "Affirmative";
  TButton* nb = dynamic_cast<TButton *>
    (Dlg->FindComponent("No"));
  if (nb)
    nb->Caption = "Negative";
  int Rslt = Dlg->ShowModal();
  switch (Rslt) {
    case mrYes: ;// do "Yes" stuff
    case mrNo:  ;// do "No" stuff

10-04 10:59