Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27404

Printed Image too large in vb 2010

$
0
0
Using vb 2010 Express windows forms.

I am printing an image of a Drivers License using the code below.

When I print, the image fills the entire page instead of the size of the image in the picturebox on my form.

What do I need to do differently so that the printed image size is the same size as the picturebox on my form?

undefined Code:
  1. Private Sub PrintDriversLicenseToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) _
  2.                                                     Handles PrintDriversLicenseToolStripMenuItem.Click
  3.         Try
  4.             AddHandler PrintDocument1.PrintPage, AddressOf Me.PrintImage
  5.             PrintDocument1.Print() ' this prints the graphic using the "PrintImage" Function below
  6.  
  7.         Catch ex As Exception
  8.             Beep()
  9.             MsgBox("Error in frmPros PrintDrivLic Rtn:  " & ex.Message)
  10.         End Try
  11.     End Sub
  12.     '****************************************************************************************************
  13.  
  14.  
  15.     Private Sub PrintImage(ByVal sender As Object, ByVal e As PrintPageEventArgs)
  16.         If BuyRadioButton.Checked = True Then
  17.             e.Graphics.DrawImage(Image.FromFile("C:\Program Files\ScanPics-DEI\" _
  18.                                     & frmProspects.txtBuyDrivLicNum.Text & ".bmp"), e.Graphics.VisibleClipBounds)
  19.         Else
  20.             e.Graphics.DrawImage(Image.FromFile("C:\Program Files\ScanPics-DEI\" _
  21.                                     & frmProspects.txtCoBuyDrivLicNum.Text & ".bmp"), e.Graphics.VisibleClipBounds)
  22.         End If
  23.  
  24.         e.HasMorePages = False
  25.     End Sub
  26.     '****************************************************************************************************

Viewing all articles
Browse latest Browse all 27404

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>