JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Creating Custom Print Previews

The PrintPreviewControl control displays print previews, and you can use it to create your own custom print preview windows—all you have to do is to assign a print document to its Document property (and have at least implemented the print document's PrintPage event handler). I've added a second form, Form2, to the Printing example on the CD-ROM to show how to create a custom print preview, and placed a print preview control, PrintPreviewControl1, in that form (and also added a Close button that closes the form). Here's what the code to launch the custom preview looks like in the Printing example:

Private Sub MenuItem4_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MenuItem4.Click
    Dim preview As New Form2()
    preview.PrintPreviewControl1.Document = PrintDocument1
End Sub

You can see the custom print preview dialog in the Printing example in Figure 9.9.

Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor