Printing a Picture Box image to a printer...

  • Thread starter Thread starter Gary
  • Start date Start date
G

Gary

Hi all,

Can anyone point me to a sample on how to print a picture box image to a
printer or do you have sample code that could show me?

Thanks,

Gary
 
Hi Gary,

Following is a code snippet illustrating how to print images of a picture box

Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click

PrintDialog1 = New PrintDialog

PrintDialog1.Document = PrintDocument1 'pbxLogo.Image

Dim r As DialogResult = PrintDialog1.ShowDialog

If r = DialogResult.OK Then

PrintDocument1.Print()

End If

End Sub

Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage

e.Graphics.DrawImage(pbxLogo.Image, 0, 0)

End Sub

HTH

Mona
 
Thanks for that,

but I am getting an error see new post near top.

Gary


Hi Gary,

Following is a code snippet illustrating how to print images of a picture box

Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click

PrintDialog1 = New PrintDialog

PrintDialog1.Document = PrintDocument1 'pbxLogo.Image

Dim r As DialogResult = PrintDialog1.ShowDialog

If r = DialogResult.OK Then

PrintDocument1.Print()

End If

End Sub

Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage

e.Graphics.DrawImage(pbxLogo.Image, 0, 0)

End Sub

HTH

Mona
 
Back
Top