開啟子窗口 的疑問(在d7中)

ddwkxyllbaihe 2003-07-29 03:54:51
procedure TForm1.openchild(AForm: TForm;AFormClass: TFormClass;childcaption:string);
var
i:integer;
begin
for i:=0 to application.ComponentCount-1 do
begin
if (application.Components[i] is AFormClass) then//加?一句。
begin
if (application.Components[i] as tform).Caption=childcaption then
begin
(application.Components[i] as tform).Show;
exit;
end
else begin
aform:=AFormClass.create(self);
aform.show;
end;
end;

end;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
openchild(form2,tform2,'form2');
end;

不報錯﹐也不顯示
問﹕該怎么修改
...全文
26 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ddwkxyllbaihe 2003-07-30
  • 打赏
  • 举报
回复
仍然 是這樣。
﹖﹖﹖﹖﹖﹖﹖﹖﹖﹖﹑﹑﹑﹑
tongki 2003-07-29
  • 打赏
  • 举报
回复
else begin
aform:=AFormClass.create(self);
aform.parent:=from1;
====================
aform.show;
end;
tongki 2003-07-29
  • 打赏
  • 举报
回复


procedure TForm1.openchild(AForm: TForm;AFormClass: TFormClass;childcaption:string);
var
i:integer;
begin
for i:=0 to application.ComponentCount-1 do
begin
if (application.Components[i] is AFormClass) then//加?一句。
begin
if (application.Components[i] as tform).Caption=childcaption then
begin
   (application.Components[i] as tform).parent:=from1;
===================================================
(application.Components[i] as tform).Show;
exit;
end
else begin
aform:=AFormClass.create(self);
aform.show;
end;
end;

end;
end;

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧