我想在 SQL 数据库中保存字体(FontStyle、FontColor、FontSize),为此,我需要将其保存为字符串。如何将 Tfont 转换为 TString?
最佳答案
要存储字体,您只需要字体的主要属性,而不是全部。我这样做是为了将字体保存到 INI 文件中。您可以轻松地将其转换为返回字符串(TString)的函数:
procedure TMyIniFile.WriteFont(CONST Section, Ident: string; Value: TFont);
begin
WriteString (Section, Ident + 'Name', Value.Name);
WriteInteger(Section, Ident + 'CharSet', Value.CharSet);
WriteInteger(Section, Ident + 'Color', Value.Color);
WriteInteger(Section, Ident + 'Size', Value.Size);
WriteInteger(Section, Ident + 'Style', Byte(Value.Style));
end;
关于delphi - 如何将字体(FontStyle、FontColor、FontSize)转换为字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19163832/