我正在使用PrintDialog
和PrintDocument
控件来打印表单。但是当我单击按钮时,它总是打印一张空白纸。我正在使用以下代码:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
PrintDialog1.Document = PrintDocument1
Dim result As DialogResult = PrintDialog1.ShowDialog
If (result = DialogResult.OK) Then
PrintDocument1.Print()
End If
End Sub
答案 0 :(得分:0)
实际打印发生在printdocument1.printpage事件处理程序中。为此,您可以在PrintPage处理程序中输出参数PrintPageEventArgs的图形对象。
AddHandler PrintDocument1.PrintPage, AddressOf printaPage
PrintDocument1.Print()
...
Sub printaPage(ByVal sender As Object, ByVal e As PrintPageEventArgs)
' output to e.Graphics here
...