Private textToPrint As String Private Sub PrintSomeText(ByVal text As String) Dim pd As New Printing.PrintDocument() Dim pDialog As New PrintDialog() If pDialog.ShowDialog() = DialogResult.Cancel Then Exit Sub pd.PrinterSettings = pDialog.PrinterSettings AddHandler pd.PrintPage, AddressOf PrintDocument_Print textToPrint = text pd.Print() End Sub Private Sub PrintDocument_Print(ByVal sender As Object, ByVal e As Printing.PrintPageEventArgs) e.Graphics.DrawString(textToPrint, Me.Font, Brushes.Black, e.MarginBounds) End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.PrintSomeText("Hello world, this is my text...") End Sub
Tekuni dan Dalami apa yang anda kerjakan sekarang, karena itu merupakan jalan hidup anda, walaupun itu jauh dari cita-cita anda sebelumnya (Syafruddin 07/07/2013)
Sabtu, 05 Januari 2013
Sent a string to LPT1 VB.NET
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar