|
想使用自带字体显示Label对象,但是虽然使用了AddFontResource把字体加好,但是好像用label1.font.name:='Droid Sans Fallback'来设定字体并不起作用,请教各位是否我的办法有点问题?下面是示例代码- procedure TfmPlatform.FormCreate(Sender: TObject);
- var
-     FontFile    :WideString;
- begin
-     FontFile:=Application.Location+'Resource\font.ttf';
-     Error:=AddFontResourceW(LPCWSTR(FontFile));
-     if Error=0 then
-     ShowMessage(Application.Location+'Resource\font.ttf Font Not Installed Error:'+IntToHex(GetLastError,8));
-     SendMessage(HWND_BroadCast,WM_FontChange,0,0);
-     Label1.Font.Handle:='Droid Sans Fallback';
-     Label1.Caption:='123450Hello';
- end;
复制代码 |
|