Tim your just great, I have managed to capture the form as a bitmap and
print it using the Print Dialog. Thanks for the help. Any ideas how I can
save the same bitmap image preferably as a Pdf file and save it to a file
folder on my c: drive. here is my code:
Dim memoryImage As Bitmap
Private Sub CaptureScreen()
Dim myGraphics As Graphics = Me.CreateGraphics()
Dim s As Size = Me.Size
memoryImage = New Bitmap(s.Width, s.Height, myGraphics)
Dim memoryGraphics As Graphics = Graphics.FromImage(memoryImage)
memoryGraphics.CopyFromScreen(Me.Location.X, Me.Location.Y, 0, 0, s)
End Sub
Private Sub printDocument1_PrintPage(ByVal sender As System.Object, ByVal e
As System.Drawing.Printing.PrintPageEventArgs) Handles _
PrintDocument1.PrintPage
e.Graphics.DrawImage(memoryImage, 0, 0)
End Sub
Public Shared Sub Main()
Application.Run(New FrmInvoice1())
End Sub
Private Sub BtnPrint_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BtnPrint.Click
CaptureScreen()
Dim PrintDialog1 As New PrintDialog()
PrintDialog1.Document = PrintDocument1
Dim result As DialogResult = PrintDialog1.ShowDialog()
If (result = DialogResult.OK) Then
PrintDocument1.Print()
End If
End Sub
"Tim Van Wassenhove" <ti***@users.sourceforge.netwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Ivan Jericevich schreef:
>Thank you Tim, I have copied the code from your source but have only one
problem. 2 Errors both- Type 'StreamReader' is not defined.
What am I missing?
StreamReader is short for System.IO.StreamReader... Or you could Imports
System.IO...
--
Tim Van Wassenhove <url:http://www.timvw.be/>