在Unit1中Interface或Implementation下写 uses unit2;然后在菜单的动作中写 if not assigned(form2) then application.createform(Tform2,form2); Form2.Show; //非模态显示 或 Form2.ShowModal; //模态显示同时在form2的ondestory 事件中写下: action:=cafree; form2:=nil;
if not assigned(aboutbox) then begin aboutbox:=Taboutbox.Create(Application); aboutbox.show; // or ShowModal; end else aboutbox.show; // or ShowModal;onclose事件: aboutbox:=nil; action:=caFree;
Form2:=TForm2.Create(self);
Form2.showmodal;
假设你的子窗口是Form2,对应的文件是Unit2.pas在Unit1中Interface或Implementation下写 uses unit2;然后在菜单的动作中写
Form2.Show; //非模态显示
或 Form2.ShowModal; //模态显示
子窗口名为about
aboutbox.show;就可以了。
if not assigned(form2) then
application.createform(Tform2,form2);
Form2.Show; //非模态显示
或 Form2.ShowModal; //模态显示同时在form2的ondestory 事件中写下:
action:=cafree;
form2:=nil;
begin
aboutbox:=Taboutbox.Create(Application);
aboutbox.show; // or ShowModal;
end
else
aboutbox.show; // or ShowModal;onclose事件:
aboutbox:=nil;
action:=caFree;