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
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