请问怎么样判断PANEL中是否有一个FORM在存呢?(100分)

  • 主题发起人 无头骑士
  • 开始时间

无头骑士

Unregistered / Unconfirmed
GUEST, unregistred user!
请问怎么样判断PANEL中是否有一个FORM在存呢?如果是其它的控件呢?
 
with (sender as Panel) do
begin
for i:=0 to ControlCount -1 do
begin
if Controls is tform then//判断PANEL中是否是TFORM
showmessage((Controls as tform).caption);
if Controls is tedit then//是否是其它的控件
(Controls as tedit).Clear;
end;
end;
 
zbwsh说得对所有TControl都有个Controls属性是个数组,里面装的是以这个控件本身为容器的
控件的集合.
 
procedure TForm1.IsFormHave;
begin
with FormPanel do
begin
if Controls[0] is TChildForm then
// Controls[0].close;
Controls[0].Free;
Controls[0].close;
end;
end;

如果是话,我想释放,可是Controls[0].close;这样不行。请教各位兄台!!
 
TChildForm(Controls[0]).close
Controls[0]是TControl那有什么CLOSE
 
procedure TForm1.IsFormHave;
begin
with FormPanel do
begin
if Controls[0] is TChildForm then
(Controls[0] as TChildForm).close;
end;
end;
 
TChildForm(Controls[0]).close;[:D]
 
结题了!!!!分已散!
 
顶部