Listbox and fonts

  • Thread starter Thread starter takapenkki
  • Start date Start date
T

takapenkki

Guest
Is it possible to get the names of all installed fonts or font-families to an array. I have tried to use System.Drawing.InstalledFontCollection and I am not sure how to use it. My goal is to get all installed fonts on a listbox. Can you give an example, because im a beginner.
 
The Families property of a new instance of the InstalledFontCollection
class returns a collection of FontFamily classes that can be
looped through in a For-Each loop. Just declare a new FontFamily,
a new instance of the IFC class, and loop through its Families property.

Code:
Dim ff As FontFamily
Dim ifc As New System.Drawing.Text.InstalledFontCollection()

For Each ff In ifc.Families
   Do something with ff (ff.Name gets the font name)
Next

By the way, the namespace to use is System.Drawing.Text.
 
Back
Top