Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleList the fonts available to the printer in Visual Basic 6
DescriptionThis example shows how to list the fonts available to the printer in Visual Basic 6.
Keywordsprinting, font, list fonts, Visual Basic 6
CategoriesGraphics
 
When the program's form loads, the code loops through the Printer object's Fonts collection and adds each font's name to a ListBox.
 
Private Sub Form_Load()
Dim i As Integer

    picSample.AutoRedraw = True
    For i = 0 To Printer.FontCount - 1
        lstFonts.AddItem Printer.Fonts(i)
    Next i
End Sub
 
When you click on an entry in the ListBox, the program draws a sample of that font.
 
Private Sub lstFonts_Click()
    If lstFonts.ListIndex < 0 Then Exit Sub

    picSample.Font = lstFonts.Text
    picSample.Cls
    picSample.CurrentX = 0
    picSample.CurrentY = 0
    picSample.Print lstFonts.Text
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated