FMX.Controls.TStyleCollectionItem.LoadFromStream

Aus RAD Studio API Documentation
Wechseln zu: Navigation, Suche

Delphi

procedure LoadFromStream(const Stream: TStream);

C++

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

Eigenschaften

Typ Sichtbarkeit Quelle Unit Übergeordnet
procedure
function
public
FMX.Controls.pas
FMX.Controls.hpp
FMX.Controls TStyleCollectionItem


Beschreibung

Methode zum Laden eines Stils aus einem Stream in ein Element der Sammlung.

Verwenden Sie zum Laden des Stils aus einer Datei LoadFromFile.

Geben Sie den vollständigen Pfad zu der Datei an oder einfach den Dateinamen, wenn sich die Datei im Projektordner befindet.

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;

Alle Plattformnamen existieren im PlatformNames-Array.

Siehe auch