PrintPreviewDialog, PrintDialog and PageSetupDialog

madcrow74

Member
Joined
Jul 1, 2003
Messages
15
Location
Italy
Hi #
I have to preview the printing of a document using a PrintPreviewDialog. This control has a Print button that print directly to the default printer, but I would let the user select hte margins and number of page to print. So Im trying to use PrintDialog and PageSetupDialog controls, but I dont know how to show them before printing.
I cannot show them before the preview is shown, but i have to refresh the preview if the printing settings are modified...
I can access the PrintPreviewDialogs toolbar, but I cannot hook to the Print method or event...

Do I miss something?
 
I think I understand what you want, so I think this will help

Code:
        PageSetupDialog1.PageSettings = PrintDocument1.DefaultPageSettings
        If PageSetupDialog1.ShowDialog() = DialogResult.OK Then
            PrintDocument1.DefaultPageSettings = PageSetupDialog1.PageSettings
        End If
        Try
            PrintPreviewDialog1.Document = PrintDocument1
            PrintPreviewDialog1.ShowDialog()
        Catch exc As Exception
            MsgBox("Print operation failed " & vbCrLf & exc.Message)
        End Try
 
Back
Top