Here is how to do it, it is quite a hack.. (perhaps better creating your own print preview dialog with the printpreviewcontrol?)
In application project there is a printdocument, a printdialog and a printpreviewdialog, the printdocument is added to both dialogs document property.
Printpreviewdialog is started with a button in main form for this example.
I found a note somewhere saying one of the controls in previewdialog was a toolbar, I get this to withevents variable and the print toolbarbutton to global variable in form_load.
Event handlers for toolbar buttonclick and mousedown is setup.
For printdocument_beginprint I have a boolean to escape printing "when I say so", in printdocument_printpage I just draw a black square.
Toolbar mousedown is where I escape printing by setting the boolean, I have found no other way to stop the default behaviour of clicking the print button in printpreviewdialog. (my own buttonclick handler is triggered after the default handler in the dialog)
Next thing that happens is buttonclick in toolbar, where the boolean is changed back to again enable printing, I check if its the print button (tbt), if so display printdialog, if 'ok' is pressed there then print document.
That's it, perhaps harder to describe than to code..
WithEvents tb As ToolBar
Private tbt As ToolBarButton
Private preview As Boolean = False
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
tb = DirectCast(PrintPreviewDialog1.Controls(1), ToolBar)
tbt = tb.Buttons(0)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PrintPreviewDialog1.ShowDialog()
End Sub
Private Sub tb_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles tb.MouseDown
preview = True
End Sub
Private Sub tb_ButtonClick(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles tb.ButtonClick
preview = False
If e.Button Is tbt Then
If PrintDialog1.ShowDialog() = DialogResult.OK Then PrintDocument1.Print()
End If
End Sub
Private Sub PrintDocument1_BeginPrint(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintEventArgs) Handles PrintDocument1.BeginPrint
If preview = True Then e.Cancel = True
End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
e.Graphics.FillRectangle(Brushes.Black, 100, 100, 100, 100)
End Sub