Lazarus中文社区

 找回密码
 立即注册(注册审核可向QQ群索取)

QQ登录

只需一步,快速开始

Lazarus IDE and 组件 下载地址版权申明
查看: 8059|回复: 0

[求教]AddFontResource如何加入自带字体

[复制链接]

该用户从未签到

发表于 2009-6-30 18:11:18 | 显示全部楼层 |阅读模式
想使用自带字体显示Label对象,但是虽然使用了AddFontResource把字体加好,但是好像用label1.font.name:='Droid Sans Fallback'来设定字体并不起作用,请教各位是否我的办法有点问题?下面是示例代码
  1. procedure TfmPlatform.FormCreate(Sender: TObject);
  2. var
  3.     FontFile    :WideString;
  4. begin
  5.     FontFile:=Application.Location+'Resource\font.ttf';
  6.     Error:=AddFontResourceW(LPCWSTR(FontFile));
  7.     if Error=0 then
  8.     ShowMessage(Application.Location+'Resource\font.ttf Font Not Installed Error:'+IntToHex(GetLastError,8));
  9.     SendMessage(HWND_BroadCast,WM_FontChange,0,0);
  10.     Label1.Font.Handle:='Droid Sans Fallback';
  11.     Label1.Caption:='123450Hello';
  12. end;
复制代码
回复

使用道具 举报

*滑块验证:

本版积分规则

QQ|手机版|小黑屋|Lazarus中国|Lazarus中文社区 ( 鄂ICP备16006501号-1 )

GMT+8, 2023-3-31 07:56 , Processed in 0.045431 second(s), 8 queries , Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表