Reputation: 1397
I'm using a WebBrowser to print some HTML data, all works good except for the print preview called in the load completed event - It opens as a very small window in the top left, anything I can do to improve this?
Private Sub BtnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPrint.Click
Dim webBrowserForPrinting As New WebBrowser()
AddHandler webBrowserForPrinting.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf PrintDocument)
webBrowserForPrinting.DocumentText = HTMLTEST()
End Sub
Private Sub PrintDocument(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs)
Dim webBrowserForPrinting As WebBrowser = CType(sender, WebBrowser)
webBrowserForPrinting.ShowPrintPreviewDialog()
End Sub
Upvotes: 3
Views: 2540
Reputation: 21088
Try setting the Parent property of your webBrowserForPrinting object to Me.
webBrowserForPrinting.Parent = Me
Upvotes: 10