473,382 Members | 1,390 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Printing a Picture Box image to a printer...

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
Nov 22 '05 #1
2 8684
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

"Gary" <sp**@spam.net.at> wrote in message news:3q******************@news-server.bigpond.net.au...
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

Nov 22 '05 #2
Thanks for that,

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

Gary
"Mona(Grapecity)" <mo**@discussions.microsoft.com> wrote in message news:uT**************@TK2MSFTNGP15.phx.gbl...
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

"Gary" <sp**@spam.net.at> wrote in message news:3q******************@news-server.bigpond.net.au...
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

Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: JF Turcotte | last post by:
Hi I'm unsuccessfully trying to print a form's image under VB.NET. To print under .NET is a real pain in the , I find it to be complex, lenghty, confusing, upsetting and ultimately not to be...
2
by: Gary | last post by:
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
0
by: Chris | last post by:
Hi, I found this code to send print direct to printer. It works perfect. Imports System Imports System.Text Imports System.Runtime.InteropServices <StructLayout(LayoutKind.Sequential)> _...
1
by: Frank.Sebesta | last post by:
I have a employees database with a picture that shows on a form with employee information. Similar to the Northwinds sample database. When I print the record, my output is only the data and does...
5
by: VMI | last post by:
I have a BMP image (the form is also in PDF) that contains a scanned copy of a paper form that we need to fill out. Is it possible to use this image in my application so that the application can...
5
by: Tom | last post by:
I am converting an old application that was printing directly to a specialized printer device (i.e. a special label printer). It was doing this by opening a file with the file path of 'LPT1:' and...
1
by: William Cruz | last post by:
This piece of code prints out a image that I have placed on a picturebox. It currently prints it @ the top left hand side of the page. I want to know how I can control where in the page this image...
8
by: Neo Geshel | last post by:
Greetings. BACKGROUND: My sites are pure XHTML 1.1 with CSS 2.1 for markup. My pages are delivered as application/xhtml+xml for all non-MS web clients, and as text/xml for all MS web...
1
by: jake | last post by:
When I draw (using DrawString() and other Draw...() methods) directly to the PrintDocument using the PrintDocument's PrintPageEventArgs e, the print-out comes out nice and sharp. But when I direct...
2
by: user | last post by:
Hi all... i am trying to print an image using GDI - but the only thing i get is a black rectangle. Does anybody know what is wrong, or how else to get the bitmap on the printer (GDI+ is not...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.