我设计了一个mdi主窗口,然后手工建立child子窗口并把它show出来。但是child一闪就没有了,代码如下:
if not assigned(child) then
begin
try
child:=Tchild.Create(self);
child.WindowState:=wsMaximized; child.Show;
LockWindowUpdate(0);
child.BringToFront();
finally
child.Free;
child:=nil;
end;
end ;
if not assigned(child) then
begin
try
child:=Tchild.Create(self);
child.WindowState:=wsMaximized; child.Show;
LockWindowUpdate(0);
child.BringToFront();
finally
child.Free;
child:=nil;
end;
end ;
begin
child:=Tchild.Create(application);
child.Show;
end ;
child.Free;
child:=nil;
当然闪一下就关闭了/
begin
child:=Tchild.Create(application);
child.Show;
end ;
-----------------------------------
这样的话,创建一个子窗体后,child不再是nil了,这样就只能创建一个子窗体了,
即使第一个子窗体被关闭。