會員登錄 - 用戶注冊 - 網(wǎng)站地圖 Office中國(office-cn.net),專業(yè)Office論壇
當前位置:主頁 > 技巧 > Access技巧 > API > 正文

Access API集中營--增加臨時使用的字體

時間:2009-09-29 08:48 來源:網(wǎng)絡 作者:朱亦文 閱讀:
正 文:

      增加臨時使用的字體,代碼如下:

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

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

也許在你的應用程序中要臨時使用某種字體,以增強程序表現(xiàn)力。

舉例:
增加“天氣”字體
Debug.Print AddFont(CurrentProject.Path & "\Fonts\tianqi.TTF")

刪除“天氣”字體
Debug.Print RemoveFont(CurrentProject.Path & "\Fonts\tianqi.TTF")

(責任編輯:admin)

頂一下
(0)
0%
踩一下
(0)
0%
發(fā)表評論
請自覺遵守互聯(lián)網(wǎng)相關的政策法規(guī),嚴禁發(fā)布色情、暴力、反動的言論。
評價: