delphi 如何让showmessage更改窗中模式

我想要让showmessage变成一个有‘确定’和‘取消’两个按钮的窗口,然后根据点击这两个不同的按钮而响应不同的事件。请跟我讲讲怎样把窗口变成这种模式并且怎样获取返回值... 我想要让showmessage变成一个有‘确定’ 和‘取消’两个按钮的窗口,然后根据点击这两个不同的按钮而响应不同的事件。
请跟我讲讲怎样把窗口变成这种模式并且怎样获取返回值,谢谢!
展开
 我来答
cx456a
2010-03-24
知道答主
回答量:16
采纳率:0%
帮助的人:17.7万
展开全部
楼上的写法固然可以,但一点注释也没有未免太不负责任,其实这样写就可以了
MessageDlg('no found',mtInformation,[mbOK],1);

'no found'里面可以替换成其他内容
诗逸愁9691
2010-03-21 · 超过30用户采纳过TA的回答
知道答主
回答量:88
采纳率:0%
帮助的人:0
展开全部
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
userResponse:integer;
begin
userResponse := MessageDlg('Choose Yes no or Cancel?', mtConfirmation, mbYesNoCancel, 0);
case userResponse of
idYes: ShowMessage('You choose Yes');
idNo: ShowMessage('You choose no');
{if the response is Cancel nothing will happen...}
idCancel: ;
end;
end;

end.
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式