Jump to content

What is default font for Listviews on Windows XP


texan
 Share

Recommended Posts

What is the default font name, size, wieght used in Windows XP for Listviews?

I created a GUI window that looks good on Windows XP but when viewed on Windows 7 the fonts in the listview appear to be different causing the listview to have scrollbars. I am currently not setting the fonts on the listview so I assume it is just using the Windows default.

I am going to use GUICtrlSetFont to set all the listviews to a fixed font and I want to use whatever font settings are currently the default on Windows XP. How can I determine what fonts are currently being used?

Link to comment
Share on other sites

Have a look at GUISetFont() I believe the Default Font (I could be wrong) is MS Shell!

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

That function is good to extract the font of a control (e.g. with the default font set). But together with Melba23 I even took it a step further :). The GetDefaultThemeFont() is used in his excellent

#include <array.au3>

Global $aFontData = _GetDefaultThemeFont()
_ArrayDisplay($aFontData)

; #INTERNAL_USE_ONLY#============================================================================================================
; Name...........: _GetDefaultThemeFont
; Description ...: Determines Windows default MsgBox font size and name
; Syntax.........: _GetDefaultThemeFont()
; Return values .: Success - Array holding determined font data
;                : Failure - Array holding default values
;                  Array elements - [0] = Size, [1] = Weight, [2] = Style, [3] = Name, [4] = Quality
; Author ........: KaFu, Melba23
; Remarks .......: Used internally by ExtMsgBox UDF
; ===============================================================================================================================
Func _GetDefaultThemeFont()

    ; Fill array with standard default data
    Local $aDefFontData[5] = [9, 400, 0, "Tahoma", 2]

    ; Get AutoIt GUI handle
    Local $hWnd = WinGetHandle(AutoItWinGetTitle())
    ; Open Theme DLL
    Local $hThemeDLL = DllOpen("uxtheme.dll")
    ; Get default theme handle
    Local $hTheme = DllCall($hThemeDLL, 'ptr', 'OpenThemeData', 'hwnd', $hWnd, 'wstr', "Static")
    If @error Then Return $aDefFontData
    $hTheme = $hTheme[0]
    ; Create LOGFONT structure
    Local Const $LOGFONT = _
            'LONG lfHeight;' & _
            'LONG lfWidth;' & _
            'LONG lfEscapement;' & _
            'LONG lfOrientation;' & _
            'LONG lfWeight;' & _
            'BYTE lfItalic;' & _
            'BYTE lfUnderline;' & _
            'BYTE lfStrikeOut;' & _
            'BYTE lfCharSet;' & _
            'BYTE lfOutPrecision;' & _
            'BYTE lfClipPrecision;' & _
            'BYTE lfQuality;' & _
            'BYTE lfPitchAndFamily;' & _
            'WCHAR lfFaceName [32];'
    Local $tFont = DllStructCreate($LOGFONT)

    Local $pFont = DllStructGetPtr($tFont)
    ; Get MsgBox font from theme
    DllCall($hThemeDLL, 'long', 'GetThemeSysFont', 'HANDLE', $hTheme, 'int', 805, 'ptr', $pFont) ; TMT_MSGBOXFONT
    If @error Then Return $aDefFontData
    ; Get default DC
    Local $hDC = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hWnd)
    If @error Then Return $aDefFontData
    $hDC = $hDC[0]
    ; Get font vertical size
    Local $iPixel_Y = DllCall("gdi32.dll", "int", "GetDeviceCaps", "handle", $hDC, "int", 90) ; LOGPIXELSY
    If Not @error Then
        $iPixel_Y = $iPixel_Y[0]
        ; Calculate point size
        $aDefFontData[0] = -Round(((1 * DllStructGetData($tFont, 1)) * 72 / $iPixel_Y), 1)
    EndIf
    ; Close DC
    DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hWnd, "handle", $hDC)
    ; Extract font data from LOGFONT structure
    $aDefFontData[1] = DllStructGetData($tFont, 'lfWeight')
    $aDefFontData[2] = 2 * (True = DllStructGetData($tFont, 'lfItalic')) + 4 * (True = DllStructGetData($tFont, 'lfUnderline')) + 8 * (True = DllStructGetData($tFont, 'lfStrikeOut'))
    $aDefFontData[3] = DllStructGetData($tFont, 'lfFaceName')
    $aDefFontData[4] = DllStructGetData($tFont, 'lfQuality')

    Return $aDefFontData

EndFunc   ;==>_GetDefaultThemeFont
Edited by KaFu
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...