PrintPreviewControl in Visual Basic .NET

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

This lesson describes the PrintPreviewControl control


Visual Basic offers a wide range of dialog boxes that allow the user to make standard selections and each of them has a very specific purpose.
The purpose of the PrintPreviewControl is displaying a print preview.

This control (the word Control helps you to differentiate it from the PrintPreviewDialog control) displays a print preview, but usually, it is easier to use the PrintPreviewDialog control described in the next lesson to display a print preview dialog box.

The PrintPreviewControl control uses PrintDocument control to generate the page(s) it needs and it displays them.


    Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) _
        Handles PrintDocument1.PrintPage

        ' Do something e.g. 
        e.Graphics.DrawString(RichTextBox1.Text, New Font("Arial", 12, FontStyle.Bold), _
          Brushes.Black, 10, 10)
        e.HasMorePages = False
    End Sub


Previous Lesson | Next Lesson

Share This

Home | About | Contact | Privacy Policy

Copyright 2018 - All Rights Reserved.