Print an image file from VB

S

S Shulman

Hi

I am looking for sample code to print an image file from VB code image can
be .jpg, .bmp etc.

Thank you in advance,

Shmuel Shulman
 
K

Ken Tucker [MVP]

Hi,

Here is a quick example. Add a button and printdocument to your
form. This will print the file camera.bmp. Hope this helps

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
PrintDocument1.Print()
End Sub

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

g.DrawImage(Image.FromFile("C:\camera.bmp"), 5, 5)
End Sub

Ken
---------------
Hi

I am looking for sample code to print an image file from VB code image can
be .jpg, .bmp etc.

Thank you in advance,

Shmuel Shulman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Click in VB the Combobox 3
bitwise operations 1
Insert formatted text fro 'Rich Text Box' 5
Drawing Tools 1
String Methods 3
Menu Question 3
Threads 2
NumericUpDown Control 2

Top