如题

解决方案 »

  1.   

    有GetFontSize这个API,但我没用过!
      

  2.   

    我将问题理解为:如何判断显示模式是大字体还是小字体
    不知道是不是楼主的意思   一个近似的方法是使用GetDeviceCaps()获得LOGPIXELSY和LOGPIXELSX的设置,一般的每英寸96个点为小字体,而120个点为大字体。不过修改字体设置必须要重新启动计算机。 
        微软推荐的检测大/小字体的方法是调用API函数GetTextMetrics()。Windows显示驱动在小字体模式下使用VGASYS.FON,而在大字体模式下使用8514SYS.FON 。下面是一个例子: 
         '** API要用到的类型 ** 
         Type TEXTMETRIC 
         tmHeight As Integer 
         tmAscent As Integer 
         tmDescent As Integer 
         tmInternalLeading As Integer 
         tmExternalLeading As Integer 
         tmAveCharWidth As Integer 
         tmMaxCharWidth As Integer 
         tmWeight As Integer 
         tmItalic As String * 1 
         tmUnderlined As String * 1 
         tmStruckOut As String * 1 
         tmFirstChar As String * 1 
         tmLastChar As String * 1 
         tmDefaultChar As String * 1 
         tmBreakChar As String * 1 
         tmPitchAndFamily As String * 1 
         tmCharSet As String * 1 
         tmOverhang As Integer 
         tmDigitizedAspectX As Integer 
         tmDigitizedAspectY As Integer 
         End Type 
         
         '** Win32 API 定义 ** 
         Declare Function GetTextMetrics Lib "gdi32" Alias "GetTextMetricsA" _ 
         (ByVal hdc As Long, lpMetrics As TEXTMETRIC) As Long 
         Declare Function GetDesktopWindow Lib "user32" () As Long 
         Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long 
         Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc _ 
         As Long) As Long 
         Declare Function SetMapMode Lib "gdi32" (ByVal hdc As Long, ByVal _ 
         nMapMode As Long) As Long 
         
         '** 常数 ** 
         Global Const MM_TEXT = 1 
         
         '** 函数 ** 
         Public Function gbl_GetFontRes() As String 
         Dim hdc, hwnd, PrevMapMode As Long 
         Dim tm As TEXTMETRIC 
         
         ' 默认返回小字体 
         gbl_GetFontRes = "VGA" 
         
         ' 获得桌面窗口的句柄 
         hwnd = GetDesktopWindow() 
         
         ' 获得桌面的上下文句柄 
         hdc = GetWindowDC(hwnd) 
         If hdc Then 
         ' 设置映射方式为点阵 
         PrevMapMode = SetMapMode(hdc, MM_TEXT) 
         
         ' 获得系统字体的大小 
         GetTextMetrics hdc, tm 
         
         ' 设置映射方式回原来的值 
         PrevMapMode = SetMapMode(hdc, PrevMapMode) 
         
         ' 释放设备上下文句柄 
         ReleaseDC hwnd, hdc 
         
         ' 如果系统字体大于16个像素,则使用大字体 
         If tm.tmHeight > 16 Then gbl_GetFontRes = "8514" 
         End If 
         
         End Function 
      

  3.   

    BOOL SystemParametersInfo(    UINT uiAction, // system parameter to query or set
        UINT uiParam, // depends on action to be taken
        PVOID pvParam, // depends on action to be taken
        UINT fWinIni  // user profile update flag
       );SPI_GETICONTITLELOGFONT