var FS : TFileStream; i : integer; begin Fs := TFilestream.Create(FileName,fmcreate or fmopernwrite); For i := 0 to controlcount - 1 do beign fs.writecomponent(controls[i] as tcomponent); end; FS.Free; end;//读取控件 var FS : TFileStream; FComponent : TComponent; begin Fs := TFilestream.Create(FileName,fmopenRead); while Fs.Position < FS.Size do begin FComponent := fs.readcomponent(nil); InsertControl(Fcomponent as tcontrol); FComponent.parent := form1; end; FS.Free; end;
var FS : TFileStream;
i : integer;
begin
Fs := TFilestream.Create(FileName,fmcreate or fmopernwrite);
For i := 0 to controlcount - 1 do
beign
fs.writecomponent(controls[i] as tcomponent);
end;
FS.Free;
end;//读取控件
var FS : TFileStream;
FComponent : TComponent;
begin
Fs := TFilestream.Create(FileName,fmopenRead);
while Fs.Position < FS.Size do
begin
FComponent := fs.readcomponent(nil);
InsertControl(Fcomponent as tcontrol);
FComponent.parent := form1;
end;
FS.Free;
end;