if fmChild=nil then
begin
fmChild:=TfmChild.Create(Self);
fmChild.Parent:=pnlScr;
fmChild.Show;
end else
begin
fmChild.Close;
fmChild.Free;
fmChild:=nil;
fmChild:=TfmChild.Create(Self);//这一句报错
fmChild.Parent:=pnlScr;
fmChild.Show;
end;
请问上面这段代码有问题么。为什么我第二次点击按钮时会报错。
...全文
52518打赏收藏
Delphi子窗体释放的问题
我在A窗体上有一个按钮,单击按钮创建子窗体B,再次单击释放B,然后重新创建。 if fmChild=nil then begin fmChild:=TfmChild.Create(Self); fmChild.Parent:=pnlScr; fmChild.Show; end else begin fmChild.Close; fmChild.Free; fmChild:=nil; fmChild:=TfmChild.Create(Self);//这一句报错 fmChild.Parent:=pn