Onclose语句(50分)

  • 主题发起人 主题发起人 phil302
  • 开始时间 开始时间
P

phil302

Unregistered / Unconfirmed
GUEST, unregistred user!
我在学习DELPHI5时不知如何用OnCloce语句,能否告知?最好能给举一个例子,并告知在何处填加。
 
OnCloce就是你在窗口关闭市触发的,比如可以释放一些东东
eg:
procedure TZJ_ZJYC.FormClose(Sender: TObject
var Action: TCloseAction);
begin
aTempQuery.close;
action := cafree;
end;
 
From <Help_TCloseAction>

procedure TForm1.FormClose(Sender: TObject
var Action: TCloseAction);

begin
if MessageDlg('Close application ?', mtConfirmation,
[mbYes, mbNo], 0) = mrYes then
Action := caFree
else
Action := caNone;
end;

caNone The form is not allowed to close, so nothing happens.
caHide The form is not closed, but just hidden. Your application can still access a hidden form.
caFree The form is closed and all allocated memory for the form is freed.
caMinimize The form is minimized, rather than closed. This is the default action for MDI child forms.

 
Croco已经解释得很清楚了.
我来将其翻译成中文:
caNone 用此参数,窗口没关闭,什么也没做
caHide 用此参数,窗口没关闭,隐藏起来了,内存未释放.
caFree 用此参数,窗口关闭,且内存释放.
caMinimize 用此参数,窗口没关闭,最小化了,内存未释放.主要用在MDI
程序中的子窗体.
 
多谢各位高人指点!
 

Similar threads

S
回复
0
查看
1K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
900
SUNSTONE的Delphi笔记
S
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
后退
顶部