How do I suppress the 'Printing' dialog with the Cancel button?

My code is as follows. I would like to suppress the 'printing' dialog that displays with a Cancel button on it.  Thanks!

  Private Sub OnPrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs)
 
        Dim bmp As Bitmap = New Bitmap(PriorsMap.Size.Width, PriorsMap.Size.Height)
        Dim rect As System.Drawing.Rectangle = New System.Drawing.Rectangle(0, 0, PriorsMap.Size.Width, PriorsMap.Size.Height)

        PriorsMap.DrawToBitmap(bmp, rect)
        bmp.Save(Application.StartupPath & "\map.bmp", System.Drawing.Imaging.ImageFormat.Bmp)

         e.Graphics.DrawImage(bmp, PriorsMap.ClientRectangle)

    End Sub
MEINMELAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MEINMELAuthor Commented:
An additional question:
I changed the paper to Landscape and the DrawImage rectangle to e.MarginBounds, and the print out looks much better.  However, it looks crooked. Is there a way to correct this?  Attached is a scanned image.
 Private Sub OnPrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs)

        ' create the bitmap that will be printed
        Using bmp As Bitmap = New Bitmap(PriorsMap.Size.Width, PriorsMap.Size.Height)

            Dim rect As System.Drawing.Rectangle = New System.Drawing.Rectangle(0, 0, PriorsMap.Size.Width, PriorsMap.Size.Height)

            PriorsMap.DrawToBitmap(bmp, rect)
            bmp.Save(Application.StartupPath & "\map.bmp", System.Drawing.Imaging.ImageFormat.Bmp)

            e.Graphics.DrawImage(bmp, e.MarginBounds)
        End Using
    End Sub
    Private Sub PrintMap()
        Using pd As New System.Drawing.Printing.PrintDocument
            AddHandler pd.PrintPage, AddressOf OnPrintPage

            ' collapse the panel with the incident list so more of the map will show
            spcDetails.Panel2Collapsed = True
            Application.DoEvents()
            pd.DocumentName = "Prior Calls " & Now

            pd.DefaultPageSettings.Landscape = True
            pd.Print()
            pd.Dispose()

            RemoveHandler pd.PrintPage, AddressOf OnPrintPage
            spcDetails.Panel2Collapsed = False
        End Using
    End Sub

Open in new window

20100401113756.pdf
0
CodeCruiserCommented:
Do you mean you want to print directly without going through the print dialog? Show us the code which invokes printing.
0
MEINMELAuthor Commented:
No, I just wanted to suppress the window that comes up showing 'printing' and has a cancel button; I have since figured out how:  
pd.PrintController = New System.Drawing.Printing.StandardPrintController .  

I sent the code in my second update, along with a scanned image of the printer output and another question.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

CodeCruiserCommented:
>However, it looks crooked. Is there a way to correct this?

Please explain what you mean.
0
MEINMELAuthor Commented:
If you look at the pdf that I attached, the picture of the bitmap looks crooked on the papaer.  I tried a couple of different printers and it always comes out looking like that.  By crooked, I mean the margin size is not straight/the same width.
0
CodeCruiserCommented:
Those are probably the page settings which need tweaking.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MEINMELAuthor Commented:
No example.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.