FireMonkey 能將目前使用的 Style 導出成文件,它提供二種文件格式,請看下列代碼:
*.style
procedure TForm1.Button1Click(Sender: TObject); var Stream1: TFileStream; begin if TStyleManager.ActiveStyle(Self) <> nil then begin Stream1 := TFileStream.Create('d:\test.style', fmCreate); // 假設文件要儲存在 d:\test.style TStyleStreaming.SaveToStream(TStyleManager.ActiveStyle(Self), Stream1, TStyleFormat.Text); FreeAndNil(Stream1); end; end;
*.fsf
procedure TForm1.Button1Click(Sender: TObject); var Stream1: TFileStream; begin if TStyleManager.ActiveStyle(Self) <> nil then begin Stream1 := TFileStream.Create('d:\test.fsf', fmCreate); // 假設文件要儲存在 d:\test.fsf TStyleStreaming.SaveToStream(TStyleManager.ActiveStyle(Self), Stream1, TStyleFormat.Indexed); FreeAndNil(Stream1); end; end;
XE8 格式支持:
TStyleFormat = (Indexed, Binary, Text);