0

我正在使用PrintDialogPrintDocument控件来打印表单。但是当我单击按钮时,它总是打印一张空纸。我正在使用以下代码:

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
4

1 回答 1

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
...
于 2013-01-09T07:08:29.167 回答