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
-
Problem with migration to C# (CoCreateInstanceEx)
by LRollison (1 replies)
-
VB6 Problem Creating Shortcuts
by rb1177 (0 replies)
-
how can i open a file
by kyawswarhtun (0 replies)
-
how to save any one form what i want?
by blackguy (5 replies)
-
Build an MP3 Player
by soybees (4 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!.