var
i:integer;
begin
for i:=0 to application.ComponentCount-1 do
if application.Components.ClassName='TForm1' then
begin
Tform1(application.Components).Caption:='11';
break;
end;
end;
我系统的一段代码,MDI窗体的,其他的也差不多.
procedure TFrmMain.CreateFormDef(Form:TFormClass);
var
i:Integer;
Flag:Integer;
begin
Flag:=0;
For i:=0 to self.MDIChildCount-1 do
begin
if self.MDIChildren.ClassName=Form.ClassName then
Flag:=1
else
if self.MDIChildren.ClassName<>'TFrm_GYInput' then
self.MDIChildren.Release;
end;
if Flag<>1 then
begin
with Form.Create(self) do
begin
Visible:=False;
ShowModal;
end;
end;
end;