
delphi 如何让showmessage更改窗中模式
我想要让showmessage变成一个有‘确定’和‘取消’两个按钮的窗口,然后根据点击这两个不同的按钮而响应不同的事件。请跟我讲讲怎样把窗口变成这种模式并且怎样获取返回值...
我想要让showmessage变成一个有‘确定’ 和‘取消’两个按钮的窗口,然后根据点击这两个不同的按钮而响应不同的事件。
请跟我讲讲怎样把窗口变成这种模式并且怎样获取返回值,谢谢! 展开
请跟我讲讲怎样把窗口变成这种模式并且怎样获取返回值,谢谢! 展开
2个回答
展开全部
楼上的写法固然可以,但一点注释也没有未免太不负责任,其实这样写就可以了
MessageDlg('no found',mtInformation,[mbOK],1);
'no found'里面可以替换成其他内容
MessageDlg('no found',mtInformation,[mbOK],1);
'no found'里面可以替换成其他内容
展开全部
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.
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.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询