开发者

WebBrowser ShowPrintPreviewDialog() very small

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.ShowP开发者_运维技巧rintPreviewDialog()
End Sub


Try setting the Parent property of your webBrowserForPrinting object to Me.

webBrowserForPrinting.Parent = Me
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜