Das ist leider kein VB6-Quellcode, sondern VB.Net!
Drucken Zum Drucken muss sich ja erst mal einen Dialog "Drucken" öffnen und das Dokument sollte bei OK-Click an den Drucker gesendet werden. Das geschieht folgend:
Dim PrintDialog1 As New PrintDialog PrintDialog1.Document = docToPrint Dim result As DialogResult = PrintDialog1.ShowDialog() If (result = Windows.Forms.DialogResult.OK) Then docToPrint.Print() End If
Damit er weiss war er bei docToPrint zu tun hat, fügen wir ein Event ein:
Private WithEvents docToPrint As New Drawing.Printing.PrintDocument
Und damit er weiss was er drucken soll, füttern wir ihn mit Draw-Informationen:
Private Sub document_PrintLinePage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles docToPrintLine.PrintPage e.Graphics.DrawImage(bild as bitmap, poindraw) e.Graphics.DrawString(text as string, drawFont, Drawing.Brushes.Black, 170, 135) e.Graphics.DrawLine(Drawing.Pens.Black, 0, 200, 700, 200) End Sub
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.