FMX.Controls.TStyleBook.LoadFromStream

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure LoadFromStream(const Stream: TStream);

C++

void __fastcall LoadFromStream(System::Classes::TStream* const Stream);

Properties

Type Visibility Source Unit Parent
procedure
function
public
FMX.Controls.pas
FMX.Controls.hpp
FMX.Controls TStyleBook

Description

Method to load a style to the TStyleBook, from a stream.

To load the style from a file use LoadFromFile.

procedure TForm1.FormCreate(Sender: TObject);
var
  S: TFileStream; 
begin
  S :=  TFileStream.Create('Air.Style', fmOpenRead);
  Stylebook1.LoadFromStream(S);
end;
procedure TForm2.FormCreate(Sender: TObject);
var
  iStream: TMemoryStream;
begin
  StyleBook1.LoadFromFile('Air.Style'); //Loads the style from a file.
  iStream := TMemoryStream.Create; //Instanziate the memory stream var.
  TStyleStreaming.SaveToStream(StyleBook1.Style, iStream); //saves the style as a memory stream.
  StyleBook1.Clear; //Clear the styles from the stylebook.
  iStream.Position := 0; //Sets the position to start the streaming.
  StyleBook1.LoadFromStream(iStream); //Loads the style to the stylebook from the memory stream.
end;

See Also