本文整理自网络,侵删。
CreateMessageDialog
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var
MsgInfo, MsgErr: TForm;
procedure TForm1.FormCreate(Sender: TObject);
begin
MsgErr := CreateMessageDialog('错误', mtError, [mbOK]);
MsgInfo := CreateMessageDialog('提示', mtInformation, [mbYes, mbNo], mbYes);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
MsgErr.ShowModal;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
MsgInfo.ShowModal;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
case MsgInfo.ShowModal of
IDYES: Text := 'Yes';
IDNO : Text := 'No';
else
Text := 'Form1';
end;
end;
end.
相关阅读 >>
Delphi xe 取得 app 自己的版本号 (狠跨 4 个平台)
Delphi生成的webservice appdebug的程序,编译时出错
Delphi - 利用dll编程控制摄像头实现拍照、录制视频
更多相关阅读请进入《Delphi》频道 >>