美好的一天, 我正在尝试使用PrintDocument打印文档
Using doc As New Printing.PrintDocument
With doc
.PrinterSettings = dlg.PrinterSettings
AddHandler doc.PrintPage, AddressOf PrintToPage
If .PrinterSettings.IsValid Then
doc.Print()
End If
End With
End Using
在“.Print()”之后,它会抛出“句柄无效”的错误。
System.Drawing
at System.Drawing.Printing.StandardPrintController.OnStartPage(PrintDocument document, PrintPageEventArgs e)
at System.Windows.Forms.PrintControllerWithStatusDialog.OnStartPage(PrintDocument document, PrintPageEventArgs e)
at System.Drawing.Printing.PrintController.PrintLoop(PrintDocument document)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()