procedure TMain.Guan;
var
m:integer;
begin
for m:=Screen.FormCount-1 downto 0 do
if Screen.Forms[m].Name <> 'Main' then
Screen.Forms[m].Free;
end;
这个是关掉除主窗体以外的所有窗体,应该能满足你的要求
在点击每个按钮之前调用
procedure TMain.Guan;
var
m:integer;
begin
for m:=Screen.FormCount-1 downto 0 do
if Screen.Forms[m].Name <> 'Main' then
Screen.Forms[m].Free;
end;
就可以了