VB.net 打印 picturebox上画的图形,但是出错提示image不能为空
PrivateSubToolStripButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)...
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
Dim MYPrintDialog = New PrintDialog
MYPrintDialog.Document = PrintDocument1
Try
If MYPrintDialog.ShowDialog() = DialogResult.OK Then
PrintDocument1.Print()
End If
Catch ex As Exception
PrintDocument1.PrintController.OnEndPrint(PrintDocument1, New System.Drawing.Printing.PrintEventArgs())
End Try
End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
e.Graphics.DrawImage(Pictemp.Image, 20, 20) ', Pictemp.Width, Pictemp.Height)
End Sub 展开
Dim MYPrintDialog = New PrintDialog
MYPrintDialog.Document = PrintDocument1
Try
If MYPrintDialog.ShowDialog() = DialogResult.OK Then
PrintDocument1.Print()
End If
Catch ex As Exception
PrintDocument1.PrintController.OnEndPrint(PrintDocument1, New System.Drawing.Printing.PrintEventArgs())
End Try
End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
e.Graphics.DrawImage(Pictemp.Image, 20, 20) ', Pictemp.Width, Pictemp.Height)
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询