SETP
asked on
Printing
I have a standard WinForm written in VB.NET 2003. I'd like to place a button on it that when the user clicks on it, it prints the form. How can I do this? I basically want a snapshot of the form on paper, but it must be done programatically. Even better would be if I could choose what part of the form I want to print (I only need the lower 3/4 of the form printed)
Thanks
Thanks
ASKER
OK, figured out the Maximized part. It's simply
PrintPreviewDialog1.Window State = FormWindowState.Maximized
PrintPreviewDialog1.Window
ASKER
In the example above, when the PrintPreviewDialog is shown, and I click on its Print button, it just prints, without going to the Windows Print screen where I can select a printer, paper orientation, copies, etc. How can I do that? It doesn't necessarily have to be then. I can have a separate place for "Page Setup" where it gets done there.
Thanks
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dim mygraphics As Graphics = oPanel.CreateGraphics
Dim s As Size = oPanel.Size
memoryImage = New Bitmap(s.Width, s.Height, mygraphics)
Dim memoryGraphics As Graphics = Graphics.FromImage(memoryI
Dim dc1 As IntPtr = mygraphics.GetHdc
Dim dc2 As IntPtr = memoryGraphics.GetHdc
BitBlt(dc2, 0, 0, oPanel.Width, oPanel.Height, dc1, 0, 0, 13369376)
mygraphics.ReleaseHdc(dc1)
memoryGraphics.ReleaseHdc(
PrintPreviewDialog1.Docume
PrintPreviewDialog1.Show()
It brings up a PrintPreview first. Only problem is that the PrintPreview appears as a small little window on the top-left corner of the screen and the Zoom is set to Auto. How can I do it so that the PrintPreview window appears maximized and the zoom is set to 100%?
Thanks