on my form in vs2005, i have a PrintPreviewDialog1, PrintDocument1 and
PictureBox1
all i want to do is print the image i have in Picturebox1 through the
PrintPreview control.
does someone have a code snippet that accomplishes this?
thanks!
gh
Herfried K. Wagner [MVP] - 19 Mar 2008 01:31 GMT
"george hardy" <nospam@nospam.com> schrieb:
> on my form in vs2005, i have a PrintPreviewDialog1, PrintDocument1 and
> PictureBox1
>
> all i want to do is print the image i have in Picturebox1 through the
> PrintPreview control.
In the 'PrintDocument' object's 'PrintPage' event you can use
'e.Graphics.DrawImage(Me.PictureBox1.Image, ...)' to draw the image onto the
print document.

Signature
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
george hardy - 19 Mar 2008 15:57 GMT
cool. that's just what i needed to get started...printing now! didn't
realize it was pinned to the event.
thanks!
> "george hardy" <nospam@nospam.com> schrieb:
>> on my form in vs2005, i have a PrintPreviewDialog1, PrintDocument1 and
[quoted text clipped - 6 lines]
> 'e.Graphics.DrawImage(Me.PictureBox1.Image, ...)' to draw the image onto
> the print document.
kimiraikkonen - 19 Mar 2008 19:47 GMT
> on my form in vs2005, i have a PrintPreviewDialog1, PrintDocument1 and
> PictureBox1
[quoted text clipped - 6 lines]
> thanks!
> gh
George,
Try this and let us know:
Private Sub PrintImage(ByVal sender As Object,_
ByVal ev As PrintPageEventArgs)
ev.Graphics.DrawImage(Image.FromFile(<filepath>),_
ev.Graphics.VisibleClipBounds)
' If no more page
ev.HasMorePages = False
End Sub
Then call PrintImage subroutine.
Hope this helps, it'll be useful also for me if it works.