|
|
Title | List the fonts available to the printer in Visual Basic 6 |
Description | This example shows how to list the fonts available to the printer in Visual Basic 6. |
Keywords | printing, font, list fonts, Visual Basic 6 |
Categories | Graphics |
|
|
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
|
|
|
|
|
|