Library code snippets
List Installed Fonts
By James Crowley, published on 14 Jul 2001
Nearly every text editor needs a combo box listing all the fonts installed on the PC, so the user can choose what font some text appears in. Fortunately, this is very simple in VB, using the Screen.Fonts() array. You could also use the Printer.Fonts() array to list the available printer fonts.
Private Sub Form_Load()
Dim I As Integer ' Declare variable.
For I = 0 To Screen.FontCount -1 ' Determine number of fonts.
List1.AddItem Screen.Fonts
(I) ' Put each font into list box.
Next I
End Sub
Related articles
Related discussion
-
Regarding Visual Basic Programme
by manjunathsl2007 (0 replies)
-
how do you hide all in VB6
by CapnJack (1 replies)
-
Problem with Input File
by novavb6 (3 replies)
-
How to produce a txt file with a table??
by novavb6 (1 replies)
-
VB6 compatability from XP to Vista
by bronx (1 replies)
i am getting error.... it says fontcount and font is not a member of screen.... wht to do....????help Plz........
If you wanted to Show the style of the FONT in real-time, just do the following:
add list1 (listbox), label1 (label) to your form
then in code:
Private Sub Form_Load()
dim i as integer
For i = 0 To Screen.FontCount - 1
List1.AddItem Screen.Fonts(i)
Next i
End Sub
Private Sub List1_Click()
Label1.Font = List1.List(List1.ListIndex)
End Sub
Yes, I'd like to know how to show a sample of the font.
this was great information, now being able to see an example of what each font looks like when a person clicks on it would be better
This thread is for discussions of List Installed Fonts.