C
CG3000
I have an Image in a picture box in VS 2005 that I want to print using
the following event handlers:
Private Sub btnPrintLabels_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
Try
Me.PrntDoc_Img.PrinterSettings.PrinterName = "Canon MF3110"
Me.PrntDoc_Img.DocumentName = "Vitex Label"
AddHandler PrntDoc_Img.PrintPage, AddressOf Me.pd_PrintPage
PrntDoc_Img.Print()
Catch ex As Exception
MessageBox.Show("An error occurred while printing", _
ex.ToString())
End Try
End Sub
' Specifies what happens when the PrintPage event is raised.
Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As
System.Drawing.Printing.PrintPageEventArgs)
' Draw a picture.
'ev.Graphics.
ev.Graphics.DrawImage(Me.PictureBox1.Image, _
ev.Graphics.VisibleClipBounds)
' Indicate that this is the last page to print.
ev.HasMorePages = False
End Sub
Problem is that is prints the image on a scale of "filling" the whole
81/.2 by 11 document
Not the scale of the image
How can I change that?
PrintPageEventArgs.Graphics class may be what I want but I dont konw
for sure.
Any ideas?
the following event handlers:
Private Sub btnPrintLabels_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
Try
Me.PrntDoc_Img.PrinterSettings.PrinterName = "Canon MF3110"
Me.PrntDoc_Img.DocumentName = "Vitex Label"
AddHandler PrntDoc_Img.PrintPage, AddressOf Me.pd_PrintPage
PrntDoc_Img.Print()
Catch ex As Exception
MessageBox.Show("An error occurred while printing", _
ex.ToString())
End Try
End Sub
' Specifies what happens when the PrintPage event is raised.
Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As
System.Drawing.Printing.PrintPageEventArgs)
' Draw a picture.
'ev.Graphics.
ev.Graphics.DrawImage(Me.PictureBox1.Image, _
ev.Graphics.VisibleClipBounds)
' Indicate that this is the last page to print.
ev.HasMorePages = False
End Sub
Problem is that is prints the image on a scale of "filling" the whole
81/.2 by 11 document
Not the scale of the image
How can I change that?
PrintPageEventArgs.Graphics class may be what I want but I dont konw
for sure.
Any ideas?