Yazı Font Küçült Yazı Font Büyült New Page

PrintDialog  

PrintDialog nesnesi ile TextBox taki stringi yazdıracağız. Formunuza 1 adet PrintDialog, Button ve TextBox ekleyin.

Public Class Form1
    Private WithEvents docToPrint As New Printing.PrintDocument
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       
        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
    Private Sub document_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles docToPrint.PrintPage

       
        Dim printFont As New System.Drawing.Font _
        ("Arial", 12, System.Drawing.FontStyle.Regular)

       
        e.Graphics.DrawString(TextBox1.Text, printFont, _
        System.Drawing.Brushes.Black, 10, 10)
    End Sub
End Class

Bir sonraki makalede buluşmak üzere. Bahadır