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

 时间:2024-10-15 01:40:10

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

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

2、自己写了个直接保存成文件文件的,记录一下unit Font2String;interfaceusesClasses, SysUtils, Dialogs, Graphics;function Font2File(AFont: TFont; APath: string): Boolean;function File2Font(APath: string; AFont: TFont): Boolean;implementationfunction Font2File(AFont: TFont; APath: string): Boolean;varFD: TFontDialog;beginResult := False;FD := TFontDialog.Create(nil);tryFD.Font.Assign(AFont);WriteComponentResFile(APath, FD);Result := True;finallyFD.Free;end;end;

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

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

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

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

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

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

delphi 如何把字体颜色保存到数据库
  • 在线如何操作PPT文档翻译工具?
  • 南昌离职后五险一金如何处理?
  • Office 365如何制作表情图标?
  • 如何给图片做成街头显示器的效果?
  • 热门搜索
    初中语文手抄报 手抄报小装饰 元旦手抄报内容大全 杜绝浪费手抄报 语言的艺术手抄报 好词好句手抄报 预防传染病手抄报资料 关于植物的手抄报 关于火灾的手抄报 廉洁手抄报图片