Solved

Fill a ListBox with System Fonts

Posted on 1998-11-05
9
257 Views
Last Modified: 2013-12-02

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.
0
Comment
Question by:vienna
9 Comments
 
LVL 1

Expert Comment

by:zivf
ID: 1443278
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
 

Author Comment

by:vienna
ID: 1443279

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
 
LVL 12

Expert Comment

by:mark2150
ID: 1443280
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
 
LVL 12

Expert Comment

by:mark2150
ID: 1443281
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:vienna
ID: 1443282

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
 
LVL 1

Expert Comment

by:csalves
ID: 1443283
Hello,
You can't do it in a normal ListBox, try another OCX from Crescent OR Apex.

Regards
0
 
LVL 15

Expert Comment

by:ameba
ID: 1443284
or use ListView control
0
 
LVL 7

Expert Comment

by:kamall
ID: 1443285
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
 
LVL 4

Accepted Solution

by:
idcanada earned 40 total points
ID: 1443286

Check the sample I sent you in your email.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now