会员登录 - 用户注册 - 网站地图 Office中国(office-cn.net),专业Office论坛
当前位置:主页 > 技巧 > Access技巧 > API > 正文

Access API集中营--增加临时使用的字体

时间:2009-09-29 08:48 来源:网络 作者:朱亦文 阅读:
正 文:

      增加临时使用的字体,代码如下:

Option Compare Database
Option Explicit
Private Declare Function AddFontResource _
        Lib "gdi32" Alias "AddFontResourceA" _
        (ByVal lpFileName As String) As Long
Private Declare Function RemoveFontResource _
        Lib "gdi32" Alias "RemoveFontResourceA" _
        (ByVal lpFileName As String) As Long

Public Function AddFont(ByVal FontPath As String) As Boolean   '增加字体
    AddFont = AddFontResource(FontPath) = 1
End Function

Public Function RemoveFont(ByVal FontPath As String) As Boolean  '删除字体
    RemoveFont = RemoveFontResource(FontPath) = 1
End Function

*********************************************************************

也许在你的应用程序中要临时使用某种字体,以增强程序表现力。

举例:
增加“天气”字体
Debug.Print AddFont(CurrentProject.Path & "\Fonts\tianqi.TTF")

删除“天气”字体
Debug.Print RemoveFont(CurrentProject.Path & "\Fonts\tianqi.TTF")

(责任编辑:admin)

顶一下
(0)
0%
踩一下
(0)
0%
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价: