Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim Today As Date
Today = Date.Now
AnyString(e.Graphics, lblCompany.Text, 145, 149)
AnyString(e.Graphics, lblAddress.Text, 145, 199)
AnyString(e.Graphics, lblPhone.Text, 145, 220)
AnyString(e.Graphics, Today.ToLongDateString(), 578, 74)
'AnyString(e.Graphics, lblCashInThai.Text, 187, 977)
'AnyString(e.Graphics, cboProduct.Text, 146, 168)
'AnyString(e.Graphics, cboTel.Text, 550, 168)
Dim i As Integer = 0
Dim CurrentYPosition As Integer = 322
Dim strColumn1 As String = ""
Dim strColumn2 As String = ""
Dim strColumn3 As Integer = 0
Dim strColumn4 As Integer = 0
Dim strColumn7 As Integer = 0
For i = 0 To lsvProductList.Items.Count - 1
strColumn1 = lsvProductList.Items(i).SubItems(0).Text
strColumn2 = lsvProductList.Items(i).SubItems(1).Text
strColumn3 = CInt(lsvProductList.Items(i).SubItems(2).Text)
strColumn4 = CInt(lsvProductList.Items(i).SubItems(3).Text)
strColumn7 = CInt(lsvProductList.Items(i).SubItems(6).Text)
AnyString(e.Graphics, strColumn1, 75, CurrentYPosition)
AnyString(e.Graphics, strColumn2, 145, CurrentYPosition)
AnyString(e.Graphics, strColumn3.ToString("#,##0"), 564, CurrentYPosition)
AnyString(e.Graphics, strColumn4.ToString("#,##0"), 618, CurrentYPosition)
AnyString(e.Graphics, strColumn7.ToString("#,##0"), 672, CurrentYPosition)
CurrentYPosition = CurrentYPosition + 20
Next
AnyString(e.Graphics, lblNet.Text, 675, 977)
End Sub
Private Sub AnyString(ByVal g As Graphics, ByVal printString As String, ByVal xPos As Integer, ByVal yPos As Integer)
Dim anyPoint As New PointF(xPos, yPos)
g.DrawString(printString, UseFont, Brushes.Black, anyPoint)
End Sub