Two button + PrintDocument1 + PrintPreviewDialog1 + RichTextBox1
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If RichTextBox1.Text = "" Then
MsgBox("Your Text is blank. please type something")
Else
PrintPreviewDialog1.ShowDialog()
End If
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
PrintDocument1.Print()
End Sub
Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim font As New Font("Arial", 16, FontStyle.Regular)
e.Graphics.DrawString(RichTextBox1.Text, font, Brushes.Black, 100, 100)
End Sub
0 comments:
Post a Comment