要求是这样的:我知道了这个窗体的名字,FORM4我也引用了这个单元,如何的写一个addform(这传入窗体的名字),我在别的地方一调用,能显示和释放这个窗体
解决方案 »
- 项目很急,希望大哥们能助我,尽快入门
- ODBC连接问题
- 怎样获取在canvas 画线的事件
- Delphi如何执行sql命令文件?
- 各位,如何将表中的数据写入word文档中?
- 中秋之前走桃花運,散分!
- Delphi 调试出现 the application seems to forzen.
- 用DELPHI写ASP组件,在ASP中Server.CreateObject("xxx.xx")后,再想修改组件代码就不能编译调试!怎么解决?
- 我遇到麻烦了 帮个忙吧 大虾们
- 再来一次,如何在程序中动态创建一个Access数据库,并存到硬盘上?
- IWDBGrid如何取得Column的属性?
- 求一个现在能用的邮件收发系统,源码(100分)delphi7
可以试试传入formclass,用formclass对象来创建
function RunShowModal(AForm:TForm;AFormClass: TFormClass;Caption:String='';IsMax:boolean=False):Boolean;//运行一个无模式窗体,窗体标题默认为空
function RunShow(AForm:TForm;AFormClass: TFormClass;Caption:String='';IsMax:boolean=False):Boolean;implementation//运行一个模式窗体,窗体标题默认为空
function RunShowModal(AForm:TForm;AFormClass: TFormClass;Caption:String='';IsMax:boolean=False):Boolean;
begin
result:=False;
if not Assigned(AForm) then
begin
try
begin
Screen.Cursor:=crHourGlass;
AForm:=AFormClass.Create(Application);
if Caption<>'' then
AForm.Caption:=Caption;
if IsMax then
begin
AForm.Align:=alClient;
AForm.WindowState:=wsMaximized;
end;
Screen.Cursor:=crDefault;
AForm.ShowModal;
result:=True;
end;
finally
begin
AForm.Free;
Screen.Cursor:=crDefault;
end;
end;
end
else begin
try
AForm.ShowModal;
result:=true;
except
end;
end;
end;//运行一个无模式窗体,窗体标题默认为空
function RunShow(AForm:TForm;AFormClass: TFormClass;Caption:String='';IsMax:boolean=False):Boolean;
begin
result:=False;
Application.ProcessMessages;
if not Assigned(AForm) then
begin
try
begin
AForm:=AFormClass.Create(Application);
if Caption<>'' then
AForm.Caption:=Caption;
if IsMax then
begin
AForm.Align:=alClient;
AForm.WindowState:=wsMaximized;
end;
AForm.Show;
result:=True;
end;
finally
end;
end
else begin
try
AForm.Show;
result:=true;
except
end;
end;
end;
end.