TTF文件,如何让程序自动注册字体呢?

解决方案 »

  1.   

    首先把下载的字体(后缀为ttf)放到\windows\Fonts里然后打开注册表,HKEY_LOCAL_MACHINE\Software\Microsoft在里面创建(项),名为“FontPath”,然后再在FontPath项里面创建字符串名为:“FontPath”,值就填“\windows\Fonts”再到HKEY_LOCAL_MACHINE\Software\Microsoft\FontLink创建(字符串)FontPath,值为\windows\Fonts然后重启手机,字体安装成功。觉得字体太小: 就进入HKEY_LOCAL_MACHINE\System\GID找到:FontLinkMethods将值1改为-1或0(数字零)重启手机如果想换其他字体,就把\windows\Fonts的字体改掉ttf后缀。再放入其他字体,重启后删除刚才改掉后缀的字体就行如果想要回系统字体,同样把\windows\Fonts的字体去掉后缀。把上面刚键的注册表删除(项除外)重启就行了
      

  2.   


    网上也搜到这个代码了,复制过去不行http://topic.csdn.net/t/20030821/18/2174211.html  三楼就是这个
    另外,怎么复制呢? 直接filecopy 不能复制ttf文件
      

  3.   

    Public Declare Function AddFontResource Lib "gdi32" Alias "AddFontResourceA" (ByVal lpFileName As String) As Long
    Public Declare Function RemoveFontResource Lib "gdi32" Alias "RemoveFontResourceA" (ByVal lpFileName As String) As Long
      

  4.   

    具体呢? 比如说我要安装C:\1.ttf 这个字体
      

  5.   

    自己装个 API-Guide,例子多多。
    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
    Dim AppPath As String
    Private Sub Form_Load()
        'The KPD-Team 2001
        'URL: http://www.allapi.net/
        'E-Mail: [email protected]
        AppPath = App.Path
        If Right$(AppPath, 1) <> "\" Then AppPath = AppPath + "\"
        'Add the font to the Windows Font Table
        AddFontResource AppPath + "myfont.ttf"
        'Write something on the form
        Me.AutoRedraw = True
        Me.FontName = "myfont"
        Me.Print "This is a test!"
    End Sub
    Private Sub Form_Unload(Cancel As Integer)
        'Remove the font from the Windows Font Table
        RemoveFontResource AppPath + "myfont.ttf"
    End Sub