我在我的form上一个panel中放置frame,我在数组中保存这些frame是否打开,但是当我第二次打开上次已经打开过又被覆盖的frame时,却打不开了!为什么?
has := false;
for i:=0 to 9 do begin
if captions[i]='模拟量查询' then begin
has := true;
break;
end;
end;
if(has = false) then begin
frame := TfrmQrymnl.Create(Self);
captions[0] := '模拟量查询';
end; frame.Parent := panelMain;不报错,也显示不了我的frame,我用过show,visible都不管用,谢谢高手了
has := false;
for i:=0 to 9 do begin
if captions[i]='模拟量查询' then begin
has := true;
break;
end;
end;
if(has = false) then begin
frame := TfrmQrymnl.Create(Self);
captions[0] := '模拟量查询';
end; frame.Parent := panelMain;不报错,也显示不了我的frame,我用过show,visible都不管用,谢谢高手了
frame := TfrmQrymnl.Create(Self);
看来你是动态生成的,那么你的隐藏应该是把刚才的fram释放了,动态生成的时候,要对它在那个容器组件上显示赋值,否则不会出现,下面的例子给你参考procedure TForm1.BitBtn1Click(Sender: TObject);
var
frm : TFrame2;
begin
frm := TFrame2.Create(nil);
frm.Parent := Panel1; //注意这里end;
has := false;
for i:=0 to 9 do begin
if captions[i]='模拟量查询' then begin
has := true;
break;
end;
end;
if(has = false) then begin
frame := TfrmQrymnl.Create(Self);
captions[0] := '模拟量查询';
end;
frame.Parent := panelMain;