Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / March 2008

Tip: Looking for answers? Try searching our database.

easy one...need to print picturebox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
george hardy - 18 Mar 2008 23:14 GMT
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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.