andre72
asked on
Let user choose printer on print-buttom for PrintPreview
Hi,
I need to print so sttuff from my application.
For this I use the printPreviewDialog control.
This works fine, only when the user press the print button now the output will ever be printed to the default printer.
Is there a way for to let the user select a printer when he pressed the button?
Or may be an other solution to change the printer for a printPreviewDialog?
Thanks
Andre
I need to print so sttuff from my application.
For this I use the printPreviewDialog control.
This works fine, only when the user press the print button now the output will ever be printed to the default printer.
Is there a way for to let the user select a printer when he pressed the button?
Or may be an other solution to change the printer for a printPreviewDialog?
Thanks
Andre
2010 (Framework 4) allows this with the PrintDialog, however, this may help with earlier versions: http://www.vbdotnetheaven.com/UploadFile/DipalChoksi/WindowsForms04202005003607AM/WindowsForms.aspx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>Is there a way for to let the user select a printer when he pressed the button?
Yes. Show them a print dialog
http://msdn.microsoft.com/en-us/library/system.windows.forms.printdialog.aspx
Yes. Show them a print dialog
http://msdn.microsoft.com/en-us/library/system.windows.forms.printdialog.aspx
That's framework 4 only, correct?
>That's framework 4 only, correct?
No.
http://msdn.microsoft.com/en-us/library/system.windows.forms.printdialog(v=VS.90).aspx
No.
http://msdn.microsoft.com/en-us/library/system.windows.forms.printdialog(v=VS.90).aspx
I use PrinDialog since Net 1.1.
But this question is about show PrintDialog when user Press the Print Button on PrintPreviewDialog.
Image1.jpg
But this question is about show PrintDialog when user Press the Print Button on PrintPreviewDialog.
Image1.jpg
ASKER
Yes you're right - I wrote about this button :-)
Thanks for your support
Thanks for your support
PrintDocument.Print
You can´nt alter this behaviour.
But PrintDocument allow you override some methods. On_BeginPrint
Also you can suscribe Event. BeginPrint
At this Point, you can call PrintDialog to get a PrinterSettings.
If Dialog - Ok, Then set Document.PrinterSettings to Dialog.PrinterSettings
If Dialog - Cancel then set e.Cancel = true - This abort action.