這裏貼一段VB的代碼,C#參照也是相似的,讀取C盤字體庫中的字體,判斷字體是否存在,不存在便可使用特殊方法對字體進行安裝字體
這對部分B/S搭建的軟件仍是能起到做用的,畢竟有些軟件設置的字體在系統庫中並不存在,若是不安得話,會出現各類亂碼的狀況,因此spa
才須要這麼作code
Private Sub CheckPmingLiuFont() Implements IHealthCheck.CheckPmingLiuFont Try Dim lo_Fkey As RegistryKey = Registry.LocalMachine Dim lo_Rkey As RegistryKey = lo_Fkey.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts") Dim ls_FontName() As String = lo_Rkey.GetValueNames() Print("20. Check the PMingLiu font.") For Each c In ls_FontName Dim myvalue As String = lo_Rkey.GetValue(c).ToString If myvalue = "mingliu.ttc" Then Print("PMingLiu is existing.") Exit Sub End If Next Catch ex As Exception End Try End Sub