代码如下:所有的窗体都是继承来自一个窗体并且是mdi子窗体。procedure TMainForm.RzGroup7Items7Click(Sender: TObject);
var
i:Integer;
begin
if SmallReportForm=nil then
try
for i := 0 to Screen.FormCount - 1 do
begin
if Screen.Forms[i].FormStyle = fsMDIChild then
begin
CloseWindow(Screen.Forms[i].Handle);
Screen.Forms[i].Close;
end;
end;
except end;
SmallReportForm:=TSmallReportForm.create(nil);
SmallReportForm.show;
end;
快了会报错
var
i:Integer;
begin
if SmallReportForm=nil then
try
for i := 0 to Screen.FormCount - 1 do
begin
if Screen.Forms[i].FormStyle = fsMDIChild then
begin
CloseWindow(Screen.Forms[i].Handle);
Screen.Forms[i].Close;
end;
end;
except end;
SmallReportForm:=TSmallReportForm.create(nil);
SmallReportForm.show;
end;
快了会报错
begin
....
end
试试
var
i:Integer;
begin
if SmallReportForm=nil then
try
for i := 0 to Screen.FormCount - 1 do
begin
if Screen.Forms[i].FormStyle = fsMDIChild then
begin
CloseWindow(Screen.Forms[i].Handle);
Screen.Forms[i].Close;
end;
end;
except end;
SmallReportForm:=TSmallReportForm.create(nil);
SmallReportForm.show;
end;
快了会报错 你的代码前后矛盾~~
前面关闭了,后面又跟着创建~~ 代码并不矛盾