Library code snippets
Displaying all system fonts in a combobox!
By Abdul, published on 14 Jul 2001
This trick show you how to add display all the fonts, which you have installed on your system, in a combobox.
On my computer, it takes some time because I have installed about 1050 fonts but I think most of the computers have about 500 fonts but anyway.
Don't worry if your your computer freezes for some seconds. If you want the fonts to be sorted(A to Z) then set its "sorted" property to true.
Here is the code:
Dim i As Long
Private Sub Form_Load()
For i = 0 To Screen.FontCount - 1
Combo1.AddItem Screen.Fonts(i)
Next
End Sub
Related articles
Related discussion
-
Run-time error '91'
by converter2009 (1 replies)
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
Another way to check if a font is installed:
Private Function IsFontInstalled(FaceName As String) As Boolean
Dim fnt As New StdFont
' Try assigning the facename
fnt.Name = FaceName
' Compare to see if the assignment took
IsFontInstalled = (fnt.Name = FaceName)
End Function
I've been looking for this. I was sure there has to be a "special" command, but didn't know what it was. You saved me a lot of brain-ache
This thread is for discussions of Displaying all system fonts in a combobox!.