FMX.Controls.TStyleCollectionItem.LoadFromStream
Delphi
procedure LoadFromStream(const Stream: TStream);
C++
void __fastcall LoadFromStream(System::Classes::TStream* const Stream);
プロパティ
種類 | 可視性 | ソース | ユニット | 親 |
---|---|---|---|---|
procedure function |
public | FMX.Controls.pas FMX.Controls.hpp |
FMX.Controls | TStyleCollectionItem |
説明
スタイルを、ストリームからコレクションの Item に読み込むためのメソッド。
スタイルをファイルから読み込むには、LoadFromFile を使用します。
ファイルへの完全パスか、プロジェクト フォルダ内にある場合にはファイル名を選択します。
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;
すべてのプラットフォーム名は、PlatformNames 配列内にあります。