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

  • Thread starter Thread starter C
  • Start date Start date
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
 
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'.
 
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.
 
Back
Top