VCL Delphi

//******************* ComponentToSave *************************
function ComponentToSave(Component: TComponent;
Filename: String): String;
var
BinStream:TMemoryStream;
begin
BinStream := TMemoryStream.Create;
BinStream.WriteComponent(Component);
BinStream.SaveToFile(Filename);
BinStream.Free;
end;
//******************* ComponentToLoad *************************
function ComponentToLoad(Filename: String): String;
var
BinStream:TMemoryStream;
StrStream:TStringStream;
s:string;
begin
BinStream := TMemoryStream.Create;
StrStream := TStringStream.Create(s);
BinStream.LoadFromFile(Filename);
ObjectBinaryToText(BinStream, StrStream);
result := StrStream.DataString;
BinStream.free;
StrStream.free;
end;
// Form 1 ve üzerindeki tüm kontrollerive ayarlarını kaydeder
ComponentToSave(Form1,'C:\Deneme1.dat');
//Kayıt yapılan dosyayı açarak bilgileri okunabilir anlamlı bir şekilde
//memo1'e yükler
Memo1.text := ComponentToLoad('C:\Deneme1.dat');