Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
500MB 27GB Web Hosting - $9.95/Month
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleList screen and printer fonts
Keywordsfont, text, printer, screen
CategoriesGraphics
 
When it starts, this program uses the Screen and Printer objects' Fonts collections to fill ListBoxes with the screen and printer font names. It then compares the two lists and selects font names that are in one list but not the other so they are easy to see.
 
Private Sub Form_Load()
Dim i1 As Integer
Dim i2 As Integer
Dim tst As Integer

    ' Fill the lists with font names.
    For i1 = 0 To Printer.FontCount - 1
        PrinterList.AddItem Printer.Fonts(i1)
    Next i1

    For i2 = 0 To Screen.FontCount - 1
        ScreenList.AddItem Screen.Fonts(i2)
    Next i2

    ' Compare the items in the lists and
    ' select any that are in one list but
    ' missing in the other
    i1 = 0
    i2 = 0
    Do While i1 < PrinterList.ListCount And _
             i2 < ScreenList.ListCount
        tst = StrComp(PrinterList.List(i1), _
            ScreenList.List(i2))
        If tst < 0 Then
            ' Form font < Screen font
            PrinterList.Selected(i1) = True
            i1 = i1 + 1
        ElseIf tst = 0 Then
            ' They match
            i1 = i1 + 1
            i2 = i2 + 1
        Else
            ' Form font > Screen font
            ScreenList.Selected(i2) = True
            i2 = i2 + 1
        End If
    Loop

    Do While i1 < PrinterList.ListCount
        PrinterList.Selected(i1) = True
        i1 = i1 + 1
    Loop

    Do While i2 < ScreenList.ListCount
        ScreenList.Selected(i2) = True
        i2 = i2 + 1
    Loop

    PrinterList.TopIndex = 0
    ScreenList.TopIndex = 0
End Sub
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated