Solved

Fill a ListBox with System Fonts

Posted on 1998-11-05
9
263 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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
 

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Suggested Courses
Course of the Month8 days, 13 hours left to enroll

615 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