Print an image file from VB

  • Thread starter Thread starter S Shulman
  • Start date Start date
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
 
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
Drawing Tools 1
bitwise operations 1
Printing Problem 2
Insert formatted text fro 'Rich Text Box' 5
String Methods 3
Menu Question 3
NumericUpDown Control 2

Back
Top