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);