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之屏幕和窗口的坐标

Delphi 获取android package name:

Delphi tlistview(tlistbox+图标显示)

如何用Delphi实现windows xp中“本地连接”的启用和禁用

Delphi idhttp下载带清理网络缓存

Delphi richedit根据鼠标位置定位光标的方法

Delphi 错误no ftp list parsers have been registered

Delphi 实现窗口与任务栏右下角对齐

Delphi tbitmap创建时提示object or class type required

Delphi+access错误"不正常地定义参数对象。提供了不一致或不完整的信息。"

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



打赏

取消

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

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

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

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

评论

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