怎么样释放窗体(30分)

L

lajiao

Unregistered / Unconfirmed
GUEST, unregistred user!
关闭窗体的时候,并没有释放窗体。请问怎么样释放窗体!
 
看是什么类型的窗体,如果是一般的,close就行了,是MDI窗体就要在这个窗体的onclose
事件加上ACTION:=cafree,其它的一样,再不放心就FORM1.FREE
 
你可以用 窗体.realse;//好象是这样的,你用用就知道了,后面的英文记不太清楚了
在窗体的close事件。
 
用form.free就可以了
 
Free and nil 比较安全。
 
在这个窗体的onclose事件加上ACTION:=cafree或者直接调用FORM名.FREE.看看帮助吧.通常情况
下FORM关闭时其实是HIDE,并没有真正释放,主窗体除外.
 
调用和释放窗体的写法如下:
Form := TForm.Create(Application);
try
Form.Showmodel;
finally
Form.Free;
end;
 
各位说得 好像我都试过,用.free一直报错,不知道是怎么回事情
 
如果是MDIChild,在Close里设置CloseAction := caClose
若不是:
应该是Free
 
我水平太差,我认为有create才free,否则无须释放什么窗体,是多此一举。
若是自建的,想:jackl, 就可以了。
Form := TForm.Create(Application);
try
Form.Showmodel;
finally
Form.Free;
end;
 
在onclose事件里添加
Action:= caFree;
Value Meaning
------------------------------------------------------------------------------
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.
 
顶部