我没试过,看了帮助也稀里糊涂,给你拷贝一段yysun的例子吧!
来自:yysun 时间:1998-10-6 23:13:01 ID:35663
我曾经如下做法,将TQuickRep存到TFileStream中,并能恢复.
const AResFile: string = 'c:/test.stm';
procedure TForm1.SaveToFile;
var Stream: TFileStream;
CName: string;
begin
CName := Copy(QuickRep1.ClassName, 2, 99);
Stream := TFileStream.Create(AResFile, fmCreate);
try
Stream.WriteComponentRes(CName, QuickRep1);
finally
Stream.Free;
end;
end;
procedure TForm1.LoadFromFile;
var Stream: TFileStream;
begin
Stream := TFileStream.Create(AResFile, fmOpenRead);
try
for I := QuickRep1.ComponentCount - 1 downto 0 do
QuickRep1.Components.Free;
Stream.ReadComponentRes(QuickRep1);
finally
Stream.Free;
end;
end;