请教一个窗口关闭的问题?(50分)

B

bgcy

Unregistered / Unconfirmed
GUEST, unregistred user!
我想在FormClose的时候,(点取窗口左上角的close),如果Button1的属性为True,
则不关闭窗口.否则关闭窗口;为什么下面不起作用?请教如何实现?
procedure TForm1.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
if Button1.Enabled=True then
showmessage('aaaaaaaaa!')
else
close;
end;
 
procedure TForm1.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
if Button1.Enabled=True then
beign
showmessage('aaaaaaaaa!')
abort;
end
else
close;
end;

建议将此代码放在queryclose事件中做。
procedure TForm1.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
if Button1.Enabled=True then
beign
showmessage('aaaaaaaaa!')
Canclose := false
end
else
canclose := true;
end;
 
同意yhaochuan
 
谢谢yhaochuan
 

Similar threads

S
回复
0
查看
626
SUNSTONE的Delphi笔记
S
S
回复
0
查看
706
SUNSTONE的Delphi笔记
S
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
512
SUNSTONE的Delphi笔记
S
顶部