- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi 将字型样式转成字串
// 字串转成字型样式
Function StringToStyle(s:String):TFontStyles;
var ft:TFontStyles;
begin
if pos('B',s) >0 then
ft := ft + [fsBold];
if pos('I',s) >0 then
ft := ft + [fsItalic];
if pos('U',s) >0 then
ft := ft + [fsUnderline];
if pos('S',s) >0 then
ft := ft + [fsStrikeOut];
Result := ft;
end;
// 字型样式转成文字
Function StyleToString(ft:TFontStyles):String;
var s:String;
begin
s:= '';
if fsBold in ft then
s := s + 'B';
if fsItalic in ft then
s := s + 'I';
if fsUnderline in ft then
s := s + 'U';
if fsStrikeOut in ft then
s := s + 'S';
Result := s;
end