delphi 如何把字体颜色保存到数据库

 时间:2026-02-14 04:48:56

1、用记事本打开dfm文件会看到类似这样的文本: object Label1: TLabel Left = 24 Top = 32 Width = 140 Height = 46 Caption = #20445#23384#23454#20363 Font.Charset = GB2312_CHARSET Font.Color = clBlue Font.Height = -35 Font.Name = #24494#36719#38597#40657 Font.Style = [fsBold, fsUnderline, fsStrikeOut] ParentFont = False end 

delphi 如何把字体颜色保存到数据库

2、自己写了个直接保存成文件文件的,记录一下 unit Font2String; interface uses Classes, SysUtils, Dialogs, Graphics; function Font2File(AFont: TFont; APath: string): Boolean; function File2Font(APath: string; AFont: TFont): Boolean; implementation function Font2File(AFont: TFont; APath: string): Boolean; var FD: TFontDialog; begin Result := False; FD := TFontDialog.Create(nil); try FD.Font.Assign(AFont); WriteComponentResFile(APath, FD); Result := True; finally FD.Free; end; end; 

delphi 如何把字体颜色保存到数据库

3、function File2Font(APath: string; AFont: TFont): Boolean; var FD: TFontDialog; begin Result := False; FD := TFontDialog.Create(nil); try ReadComponentResFile(APath, FD);//如果此外为nil,下面的注册去掉 AFont.Assign(FD.Font); Result := True; finally FD.Free; end; end; 

delphi 如何把字体颜色保存到数据库

4、//initialization //RegisterClass(TFontDialog); end. 

delphi 如何把字体颜色保存到数据库

5、例子:procedure TForm1.Button1Click(Sender: TObject); begin Font2File(Label1.Font, 'd:\Font.fnt');//把字体保存成文件 end; procedure TForm1.Button2Click(Sender: TObject); begin File2Font( 'd:\Font.fnt', Label2.Font);//从文件里读取字体 end;

delphi 如何把字体颜色保存到数据库

  • 在线如何操作PPT文档翻译工具?
  • 南昌离职后五险一金如何处理?
  • Office 365如何制作表情图标?
  • 如何给图片做成街头显示器的效果?
  • YZR系列三相异步电动机工作环境
  • 热门搜索
    感恩父母的手抄报 新冠状病毒手抄报 推广普通话手抄报文字 关于科普的手抄报 欢庆六一手抄报资料 美丽校园手抄报 世界环境日手抄报 西游记手抄报图片 清明节的手抄报三年级 朝花夕拾手抄报 初一