调用FindComonent('Form1'),它返回一个TCOMPONENT
解决方案 »
- 关于delphi编译有种说法,大家知道吗?
- 关于TREEVIEW的问题
- hongqi162(失踪的月亮)来领分吧,呵呵,进来的都有分
- MIDAS三层结构中,在客户端新增记录没有显示在DBGrid,SQL2000数据库却有更新的记录.
- 导出到excel问题(急啊)
- SOCKET问题
- 求购制造生产企业MRP生产管理加企业管理集成系统软件
- SQLServer2000中Master中的sp_updatestats存储过程是做什么用的?
- Delphi怎么才能和Mysql一起使用?
- 如何将DBGRID中的多条记录通过QRDBTEXT同时打印出来!
- 大家一起来吧!
- 为什么报表打印中 QRDBText 和 QRLabel 控件在预览的时候字与字之间会发生重叠的现象,请问如何调整! 急急急
var
MyForm: TForm;
ss:string
begin
ss:='Form1';
MyForm := (Application.FindComponent(ss) as TForm);
MyForm.ShowModal;
end;
MyForm: TForm;
ss:string
begin
ss:='Form1';
MyForm := (Application.FindComponent(ss) as TForm);
MyForm.ShowModal;
end;
MyForm: TForm;
ss:string
begin
ss:='Form1';
MyForm := (Application.FindComponent(ss) as TForm);
MyForm.ShowModal;
end;
MyForm: TForm;
ss:string
begin
ss:='Form1';
MyForm := (Application.FindComponent(ss) as TForm);
MyForm.ShowModal;
end;
TEdit(FindComponent('Edit'+IntToStr(iTag))).Text:=StrTemp;
先全部创建所有的Form,并且关闭的时候不能释放,
除非退出系统。var ss:string ;
begin
ss := 'Form2';
(Application.FindComponent(ss) As TForm).Show;
end;小何,最近一直在南京?没出去?
先全部创建所有的Form,并且关闭的时候不能释放,
除非退出系统。var ss:string ;
begin
ss := 'Form2';
(Application.FindComponent(ss) As TForm).Show;
end;小何,最近一直在南京?没出去?
先全部创建所有的Form,并且关闭的时候不能释放,
除非退出系统。var ss:string ;
begin
ss := 'Form2';
(Application.FindComponent(ss) As TForm).Show;
end;小何,最近一直在南京?没出去?
TForm1(application.FindComponent(s)).caption:='test';一定要用application.FindComponent否则会出错
一个MDI的程序,子FORM都是动态通过配置文件来载入,配置文件只包括FORM的Name,
问题是:我怎么样通过这个串,来载入这个子FORM.
前面的方法我在没有发贴子只前早就实验过了,是不行的.因为我的FORM是动态载入的,FindComponent根本没有这个实例.如果你懂的话请高言。
问题解决300分另外开帖子。
试试这个方法,不知是否满足你的要求。
1、在你每个MDI子Form的单元中加以下代码
initialization
RegisterClasses([TYourMDIForm]);
2、在你的一个单元中定义:
type
TMyFormClass = class of TForm;
3、写一下代码:
var
AForm: TForm;
AFormClass: TMyFormClass;
begin
AFormClass := FindClass('TYourMDIForm') as TMyFormClass;
AForm := AFormClass.Create(Application);
AForm.Show;
end;不知以上想法是否符合你的要求。
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
lst:TStringlist;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
lst:=TStringlist.Create;end;procedure TForm1.Button1Click(Sender: TObject);
begin
lst.AddObject('form1',form1);
end;procedure TForm1.Button2Click(Sender: TObject);
var
k:integer;
begin
if lst.Find('form1',k) then begin
with (lst.Objects[k] as Tform1).Create(application) do begin
show;
....
....
free;
end;
end;
end;procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
lst.Free;
end;end.
{
Form1 = new TForm1(NULL);
Form1->Show();
}
else if(....)
{
.......
}
else ....
procedure TfrmMain.miQualityCertificatesClick(Sender: TObject);
var
frmBeforePaying: TfrmBeforePaying;
begin
dmCommon.ChanZhiShu :=true;
frmBeforePaying:= TfrmBeforePaying.Create(Application);
if frmBeforePaying.ShowModal() = mrCancel then
exit;
if not Assigned(frmCertificates) then
frmCertificates:=TfrmCertificates.Create(Application);
frmCertificates.Show;
end;
1.你把每一个要使用的子form都做成一个dll文件,在dll文件中定义一个已 知函数,用这个函数来完成创建form的工作。
2.在主程序中用loadlibrary引入要使用form所在的动态库,然后调用dll文 件中已知的函数完成创建工作。
哎,在PB中一句话就搞定的,在Delphi中这么难?
FileStream:TFileStream;
Form: TForm;
begin
FileStream := TFileStream.Create('Form1.dfm',fmOpenRead);
try
Form := FileStream.ReadComponent(nil);
if Assigned(Form) then
Form.Show;
finally
FileStream.Free;
end;
end;
type
PForm =^TForm;然后定义一个数组什么的,在CreateForm时候建立对应表
to chechy(我爱洁洁)
你的办法对已经装入.dpr的.Pas可以,我的问题是.Pas是动态加载的。你的方法不错的,向你学习。
smhpnuaa(农奴翻身感谢党) :你的方法其实和chechy(我爱洁洁)的思路上一样,感谢你参与。
to arg(雨隼) :你基本理解了我的意思。
to BCB_FANS(四大名捕之追杀令) :难道我说的还不清楚吗?to arg(雨隼) 其实已经明白了。谢谢你的思路。
to SQL5560(最后一朵蝴蝶兰) :谢谢你提供的帮助,不过不是我想要的。
to huazhb(), yansea(思宏) :采用dll肯定是不行的,因为.pas文件太多(19个子系统 320多个 窗体文件)
to niu_zai(牛仔) :一种新的办法,可以参考。
to 9527(?????) :也不错。。
怎么Delphi……
其实,我认为,用dll不错,如果是dll很多,你可以做成一个大dll,或安子系统来分割,都提供一个createform接口,而传人的参数就是窗体的名字,让dll为你匹配合适的东西。
在pb中你讲的东西之所以比较容易实现,以为他是脚本语言(从前),脚本本来就是它的范本。
其实上面的永久化的方法,并不适用于你的问题,因为他会保持对象的发布属性的运行期值。你要的是一个生成窗体扥恩管理,而不是记住当时的状态。
大系统的管理配置和省级一般都是通过dll方式。
你想谈的问题如果升级,具体一点比较好谈。