1 2 3 4 5 6 7 8 9 10 11 12 13 14
| Imports System.Drawing.Printing
Public Class Form1
Dim fnt As Font = New Font("Arial", 10, FontStyle.Regular, GraphicsUnit.Point)
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
Dim ps As PrinterSettings = New PrinterSettings
ps.PrinterName = "CutePDF Writer"
PrintDocument1.PrinterSettings = ps
PrintDocument1.Print()
End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim gfx As Graphics = e.Graphics
gfx.DrawString(txtTest.Text, fnt, Brushes.Black, 0, 0)
End Sub
End Class |
Partager