FMX.Controls.TStyleCollectionItem.LoadFromStream
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 | TStyleCollectionItem |
Description
Method to load a style, to an Item of the collection, from a stream.
To load the style from a file use LoadFromFile.
Select the full path to the file or the file name when located in the project folder.
procedure TForm1.FormCreate(Sender: TObject);
var
S: TFileStream;
begin
S:= TFileStream.Create('Air.Style',fmOpenRead);
StyleBook1.Styles.Add.DefaultItem; //Adds an item to the collection.
StyleBook1.Styles.Add.Platform := 'Windows'; //Adds an item as a Windows platform.
Stylebook1.Styles.Items[1].LoadFromStream(S); //Loads the style to the item from the stream var.
if Stylebook1.Styles.Items[1].IsEmpty then
ShowMessage('The style 1 is emprty')
else
Stylebook1.CurrentItemIndex := 1; //Sets item 1 as current value.
Form2.StyleBook := Stylebook1; //Applies the style from the item 1 to the form.
ShowMessage('The style 1 is not empty');
ShowMessage('Style loaded for platform:' + Stylebook1.Styles.Items[1].platform);
end;
All platform names exist in PlatformNames array.