Сохранить и загрузить TTreeView
Оформил: DeeCo
Автор: http://www.swissdelphicenter.ch
{
Treeview1.SaveToFile('...') doesn't store images.
Instead, use the code below.
}
{
Treeview1.SaveToFile('...') speichert Bitmaps im Treeview nicht.
Um auch die Bitmaps eines Treeviews zu speichern,
benutze untenstehenden Code.
}
// Save
procedure TForm1.Button1Click(Sender: TObject);
var
F: TFileStream;
begin
F := TFileStream.Create('c:\TreeView.txt', fmCreate or fmShareCompat);
try
F.WriteComponent(TreeView1);
finally
F.Free;
end;
end;
// Load
procedure TForm1.Button2Click(Sender: TObject);
var
F: TFileStream;
begin
F := TFileStream.Create('c:\TreeView.txt', fmOpenRead or fmShareDenyWrite);
try
F.ReadComponent(TreeView1);
finally
F.Free;
end;
end;
|