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

相关阅读 >>

Delphi downloadtomemory

Delphi 数据异或校验

Delphi 关于 "高位" 与 "低位"

Delphi richedit选中文字右键菜单的实现

Delphi中使用directx截屏函数

Delphi sql server备份脚本

Delphi 用ado从文本文件中导入数据库的两种方法比较

Delphi 跨平台的,在fmx中读取icon文件的每一帧到bitmap

Delphi winapi: findwindow、findwindowex - 查找窗口

Delphi 结合正确的url

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...