Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim pd As PrintDocument = New PrintDocument '假定为默认打印机
AddHandler pd.PrintPage, New System.Drawing.Printing.PrintPageEventHandler(AddressOf Me.pd_PrintPage)
pd.Print()
End Sub
Private Sub pd_printpage(ByVal sender As Object, ByVal ev As System.Drawing.Printing.PrintPageEventArgs)
Dim yPos As Single = 0
Dim yadd As String
Dim summoney, summoney2 As Decimal
Dim i As Integer = 20
Dim line As String
line = Space(12) & "前台结帐帐单"
yPos = 12
yadd = 50
ev.Graphics.DrawString(line, New Font("arial", 11, FontStyle.Regular), Brushes.Black, yPos, yadd)
line = Space(12) & "我得繁森"
yPos = 12
For i = 1 To 20
yadd = yadd + 100
ev.Graphics.DrawString(line, New Font("arial", 11, FontStyle.Regular), Brushes.Black, yPos, yadd)
Next
line = Space(12) & "结束结束"
yPos = 12
yadd = yadd + 100
ev.Graphics.DrawString(line, New Font("arial", 11, FontStyle.Regular), Brushes.Black, yPos, yadd)
End Sub