delphi 如何把字体颜色保存到数据库
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

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;

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;

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:44
阅读量:66
阅读量:94
阅读量:91
阅读量:95