拾
拾荒者
Unregistered / Unconfirmed
GUEST, unregistred user!
初学者的问题:如何才能不在 .dpr 中Application.CreateForm(TForm2, Form2);,而在单元中需要时才 Create ?(30分)<br />这是个工程方件:
program FromTest;
uses
Forms,
FromTest1 in 'FromTest1.pas' {Form1},
FromTest2 in 'FromTest2.pas' {Form2};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.Run;
end.
我有两个 Form :Form1 和 Form2,我不想像上面那样编译后的 FromTest.exe 一运行就在内存中创
费这两个 Form 。(因为如果有十几个 form 时耗内存可想而知了。) 想只在有需要时才 创建
Form2。怎样实现?
program FromTest;
uses
Forms,
FromTest1 in 'FromTest1.pas' {Form1},
FromTest2 in 'FromTest2.pas' {Form2};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.Run;
end.
我有两个 Form :Form1 和 Form2,我不想像上面那样编译后的 FromTest.exe 一运行就在内存中创
费这两个 Form 。(因为如果有十几个 form 时耗内存可想而知了。) 想只在有需要时才 创建
Form2。怎样实现?