Torna al Thread
Public Class Form1
Private WithEvents docToPrint As New Printing.PrintDocument
Private Sub document_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles docToPrint.PrintPage
Dim text As String = "In document_PrintPage method."
Dim printFont As New System.Drawing.Font("Arial", 35, System.Drawing.FontStyle.Regular)
e.Graphics.DrawString(text, printFont, System.Drawing.Brushes.Black, 10, 10)
End Sub
Private Sub btnPRINT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPRINT.Click
Dim PrintDialog1 As New PrintDialog
PrintDialog1.AllowSomePages = True
PrintDialog1.ShowHelp = True
PrintDialog1.Document = docToPrint
Dim result As DialogResult = PrintDialog1.ShowDialog()
If (result = DialogResult.OK) Then
docToPrint.Print()
End If
End Sub
End Class