我正在使用WebBrowser来打印一些HTML数据,除了在加载完成事件中调用的打印预览外,一切都很好 - 它在左上角打开一个非常小的窗口,我可以做些什么来改善这个?
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
Run Code Online (Sandbox Code Playgroud)
尝试将webBrowserForPrinting对象的Parent属性设置为Me.
webBrowserForPrinting.Parent = Me
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2230 次 |
| 最近记录: |