vb.net控制直接打印程序
Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As Printing.PrintPageEventArgs)'Dim leftMargin As Single = ev.MarginBounds.Left
Dim line1 As String = Trim(TextBox6.Text).Substring(0, 14)
Dim line2 As String = TextBox6.Text.ToString.Substring(14, 5)
ev.Graphics.DrawString(TextBox1.Text, printFont, Brushes.Black, xPos, yPos + 25, New StringFormat())
ev.Graphics.DrawString(TextBox2.Text + TextBox8.Text, printFont, Brushes.Black, xPos, yPos + 65, New StringFormat())
ev.Graphics.DrawString(TextBox3.Text + TextBox7.Text, printFont, Brushes.Black, xPos, yPos + 110, New StringFormat())
ev.Graphics.DrawString(TextBox4.Text, printFont, Brushes.Black, xPos, yPos + 155, New StringFormat())
ev.Graphics.DrawString(TextBox5.Text, printFont, Brushes.Black, xPos, yPos + 200, New StringFormat())
ev.Graphics.DrawString(line1, printFont, Brushes.Black, xPos + 50, yPos + 240, New StringFormat())
ev.Graphics.DrawString(line2, printFont, Brushes.Black, xPos - 70, yPos + 270, New StringFormat())
' Indicate that this is the last page to print.
ev.HasMorePages = False
End Sub