Advertisement
Advertisement
| 11.21.2007 at 11:40AM PST, ID: 22976312 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: |
Private objBitmap As New Bitmap(765, 800)
Private Sub butPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butPrint.Click
Try
Dim objGraphics As Graphics
Dim objFont As New Font("Arial", 12, FontStyle.Regular)
objGraphics = Graphics.FromImage(objBitmap)
objGraphics.DrawImage(objBitmap, 0, 0)
objGraphics.DrawString(str1.ToString, objFont, Brushes.Black, 50, 50)
objGraphics.DrawString(str2.ToString, objFont, Brushes.Black, 90, 100)
objGraphics.DrawString(str3.ToString, objFont, Brushes.Black, 90, 240)
Dim objPoint As Drawing.Point
objPoint.X = "90"
objPoint.Y = "200"
objGraphics.DrawImageUnscaled(image1, objPoint)
objGraphics.Save()
Dim objDoc As New PrintDocument
objDoc.PrinterSettings.PrinterName = prnName
AddHandler objDoc.PrintPage, AddressOf Me.pd_PrintPage
objDoc.Print()
lblStatus.Text = "Printing Complete"
Catch ex As Exception
lblStatus.Text = ex.Message
End Try
End Sub
Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As PrintPageEventArgs) _
Handles objDoc.PrintPage
' Draw a picture.
ev.Graphics.DrawImage(objBitmap, _
ev.Graphics.VisibleClipBounds)
' Indicate that this is the last page to print.
ev.HasMorePages = False
End Sub
|