我用编程delphi,delphi7运行时出现错误,是创建一个简单窗口,关闭的时候,显示提示是否要关闭?代码如下
unitUnit1;interfaceusesWindows,Messages,SysUtils,Variants,Classes,Graphics,Controls,F...
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
label1.Caption:='我要努力学好delphi';
label1.Visible:=true;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
form1.close ;
end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
var i:word;
begin
i:=messagedlg('是否要关闭窗口?',mtconfirmation,[mbyes,mbno],l);
if i=mryes;
then canclose:=true;
else canclose:=false;
end;
end. 展开
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
label1.Caption:='我要努力学好delphi';
label1.Visible:=true;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
form1.close ;
end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
var i:word;
begin
i:=messagedlg('是否要关闭窗口?',mtconfirmation,[mbyes,mbno],l);
if i=mryes;
then canclose:=true;
else canclose:=false;
end;
end. 展开
展开全部
procedure TForm1.btn1Click(Sender: TObject);
begin
form1.Close;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if MessageDlg('是否关闭',
mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
action:=caFree;
end
else
Action:=caNone;
end;
begin
form1.Close;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if MessageDlg('是否关闭',
mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
action:=caFree;
end
else
Action:=caNone;
end;
金山毒霸
2024-10-31 广告
2024-10-31 广告
大部分系统错误,是因为某些DLL文件丢失造成的,比如未安装DirectX9或DirectX 9.0组件已损坏、缺少Visual C ++库、未安装.net库。解决方法如下:一、 手动解决方法1、先确定电脑操作系统是多少位的,现在的电脑一般都...
点击进入详情页
本回答由金山毒霸提供
展开全部
procedure Tform1.Btn_exit.Click(sender:TObject);
begin
if messagedlg('是否退出',mtwarning,[mbyes,mbno],0)=mrYes then
begin
form1.close;
end;
begin
if messagedlg('是否退出',mtwarning,[mbyes,mbno],0)=mrYes then
begin
form1.close;
end;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
var i:word;
begin
canclose:=false
if messagedlg('是否要关闭窗口?',mtconfirmation,[mbyes,mbno],l)=mryes then
Application.Terminate;
end;
begin
var i:word;
begin
canclose:=false
if messagedlg('是否要关闭窗口?',mtconfirmation,[mbyes,mbno],l)=mryes then
Application.Terminate;
end;
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询