Fill a ListBox with System Fonts


How do you fill a ListBox (List1) with the TrueTypes
Fonts on the system?

I do NOT want to see a preview, but rather their names
AND the True Type image on my left.

I have the Image.

Thank you.
viennaAsked:
Who is Participating?
 
idcanadaConnect With a Mentor Commented:

Check the sample I sent you in your email.
0
 
zivfCommented:
I usually don't write answer as code, but this one was far too much.
Go and read the visual basic documentation, you might find some interesting stuff there.
here is the code,

Dim i As Integer
For i = 0 To Screen.FontCount - 1
    Me.Combo1.AddItem Screen.Fonts(i)
Next i

0
 
viennaAuthor Commented:

zivf,
you hardly even read my question.
1st you wrote it for a comboBox, not that I care because it will work as well,
but you missed out on the most important part of my question.
Adding an image for each font. I can use my own. 16 x 16


0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
mark2150Commented:
I can do it in a rich text box, but not (easily) in a list box. If that works let me know & I'll post code.

M

0
 
mark2150Commented:
Here is example using RTB. Set up form with a List and a RichTextBox

maxfonts = Screen.FontCount - 1
List1.Clear
For i = 0 To maxfonts
       List1.AddItem Screen.Fonts(i)
Next i
RTB1.Text = ""
RTB1.TextRTF = ""
For i = 0 To maxfonts
        work = List1.List(i)
        RTB1.SelFontName = work
        RTB1.SelText = work & vbCrLf
Next i

0
 
viennaAuthor Commented:

Is everyone missing out on my question?
The image, how do you NOT only get the system fonts
but insert an image from an image list!
In a listbox, can it be done?
0
 
csalvesCommented:
Hello,
You can't do it in a normal ListBox, try another OCX from Crescent OR Apex.

Regards
0
 
amebaCommented:
or use ListView control
0
 
kamallCommented:
vienna,
As csalves said, you can not incorporate images in a list box control. You can use the ListView control as ameba suggested.
If you need code, leave me a comment.
Regards
0
All Courses

From novice to tech pro — start learning today.