PrintDocument.Print shows also the little window - "Page 1 of document"

C

C

I would like to print the form as it is using PrintDocument. The
following code leads to the little window "Printing: Page 1 of
document" also getting copied to the bitmap and printed. Is there a
way to avoid that? Thanks.

Private Sub cmdPrint_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles cmdPrint.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 mImage As Bitmap
Dim myGraphics As Graphics = Me.CreateGraphics()
Dim s As Size = Me.Size
mImage = New Bitmap(s.Width, s.Height, myGraphics)
Dim mGraphics As Graphics = Graphics.FromImage(mImage)
mGraphics.CopyFromScreen(Me.Location.X, Me.Location.Y, 0, 0,
s)
e.Graphics.DrawImage(mImage, 0, 0)
End Sub
 
H

Herfried K. Wagner [MVP]

Am 29.09.2010 21:35, schrieb C:
I would like to print the form as it is using PrintDocument. The
following code leads to the little window "Printing: Page 1 of
document" also getting copied to the bitmap and printed. Is there a
way to avoid that? Thanks.

You can remove the progress window completely: To do so, set the
'PrintDocument' object's 'PrintController' property to a new instance of
'System.Drawing.Printing.StandardPrintController'.
 
C

C

Am 29.09.2010 21:35, schrieb C:


You can remove the progress window completely:  To do so, set the
'PrintDocument' object's 'PrintController' property to a new instance of
'System.Drawing.Printing.StandardPrintController'.

Thanks. I have a similar problem with screen capturing. I will write a
new message with a new subject line.
 

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

Top