Delphi中Messagedlg用法

Delphi中Messagedlg用法

if MessageDlg('即将退出,是否继续?', 
mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
Close; 
end;

对话框类型:

mtwarning——含有感叹号的警告对话框
mterror——含有红色叉符号的错误对话框
mtinformation——含有蓝色i符号的信息对话框
mtconfirmation——含有绿色问号的确认对话框
mtcustom——不含图标的一般对话框,对话框的标题是程序的名称

按钮组中的按钮:

mbYes——mrYes或6
mbNo——mrNo或7
mbOk——mrOk或1
mbCancel——mrCancel或2
mbHelp——help按钮
mbAbort——mrAbort或3
mbRetry——mrRetry或4
mbIgnore——mrIgnore或5
mbAll——mrAll或8
mbNoToAll——9
mbYesToAll——10
procedure TForm1.Button1Click(Sender: TObject);
var
S:string;
begin
if MessageDlg('提示框',mtInformation,[mbok,mbyes],0)=mryes then
      messagebeep(MB_ICONEXCLAMATION);
end;
TMsgDlgType = (mtWarning, mtError, mtInformation, mtConfirmation, mtCustom);

TMsgDlgBtn = (mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore,
    mbAll, mbNoToAll, mbYesToAll, mbHelp);
const
mrNone     = 0;
mrOk       = idOk;
mrCancel   = idCancel;
mrAbort    = idAbort;
mrRetry    = idRetry;
mrIgnore   = idIgnore;
mrYes      = idYes;
mrNo       = idNo;
mrAll      = mrNo + 1;
mrNoToAll = mrAll + 1;
mrYesToAll = mrNoToAll + 1;

你可能感兴趣的:(Delphi,Delphi,Messagedlg,对话框)