StartUpPosition =
Begin VB.ComboBox cmboFonts
Height
Left
TabIndex
Text
Top
Width
End
Begin VB.CommandButton cmdExit
Caption
Height
Left
TabIndex
Top
Width
End
Begin VB.CommandButton cmdPrint
Caption
Height
Left
TabIndex
Top
Width
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Print label by clicking print button with the mouse
Private Sub cmdPrint_Click()
'font name as seen in application font list box
'if not found, driver will inform GDI to generate an
'image that will be downloaded
Printer.FontName = cmboFonts.Text
'1,440 twips equals one inch
Printer.Height = 6480
Printer.Width = 5760
Printer.CurrentX = 1440
Printer.CurrentY = 2160
Printer.Print "0123456789"
Printer.EndDoc
End Sub
Private Sub Form_Load()
Dim X As Printer
Dim I As Integer 'Used for the font list
' search for printer queue name / driver name
For Each X In Printers
If X.DeviceName = "Datamax I-4206" Then 'printer found
' Set printer as system default.
Set Printer = X
For I = 0 To Printer.FontCount - 1
170
Appendix B – Sample Programs
3
'Windows Default
=
315
=
90
=
2
=
"Font List"
=
45
=
2130
=
"Quit"
=
465
=
1350
=
1
=
495
=
825
=
"Print"
=
465
=
90
=
0
=
495
=
870
'4.5 inches in twips
'4 inches in twips
'1 inch (column position)
'2 inches (row position)
' Determine number of fonts.
Class Series 2 Programmer's Manual