Delphi 常用4种对话框


本文整理自网络,侵删。

 

procedure ShowInfo(const Text, Title: string);
begin
  MessageBox(0, PChar(Text), PChar(Title), MB_OK or MB_ICONINFORMATION);
end;

procedure ShowError(const Text: string; const Title: string = '');
begin
  MessageBox(0, PChar(Text), PChar(Title), MB_OK or MB_ICONEXCLAMATION);
end;

function ShowWarning(const Text: string; const Title: string = ''): Boolean;
begin
  Result := MessageBox(0, PChar(Text), PChar(Title), MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) = IDYES;
end;

function ShowQuestion(const Text: string; const Title: string = ''): Boolean;
begin
  Result := MessageBox(0, PChar(Text), PChar(Title), MB_YESNO or MB_ICONQUESTION) = IDYES;
end;


procedure TForm1.Button1Click(Sender: TObject);

begin

ShowInfo('内容','标题');
ShowError('内容','标题');
if ShowWarning('内容','标题') then ShowMessage('yes');
if ShowQuestion('内容','标题') then ShowMessage('yes');

end;

end.

相关阅读 >>

Delphi fdmemtable中如何在已有的字段数据集上加入字段

Delphi ifdef 另类用法

Delphi 取得开机时间 开机时间总长度(可精确到秒,分钟等)

Delphi如何判断一个combobox是否处于下拉状态

Delphi xe5做一个android网页框架

Delphi winsoft comport for android usb

Delphi获取控件界面图像“新招”

Delphi 选择文件夹对话框 (有新建文件夹按钮)修正版

Delphi中指针和地址切换的方法

Delphi气泡提示

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...