Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use the Print Dialog

Tags:

c#

printing

If you go in Visual Studio 2005 to the following (or just do ctrl+p): File ==> Print..

You get a print dialog screen. I want the same in my program, but how?

like image 902
Remco Avatar asked Nov 08 '11 14:11

Remco


People also ask

How do I bring up the print dialog?

To display the Print dialog box, click (Down arrow) of the Print button or the Start Printing button in the Preview screen, and select Check Settings and Print....

What does print dialog mean?

The Print dialog box lets the user select options for a particular print job. For example, the user can specify the printer to use, the range of pages to print, and the number of copies.

Where is the print dialog?

The print dialog box is a window that allows you to select various options for printing your workbook. You can access the print dialog box by clicking the File tab, then click Print, or by pressing the Ctrl+P keys on your keyboard.


2 Answers

This dialog box is a so-called common dialog, a built-in Windows dialog that can be used by multiple applications.

To use this dialog box in your C# application, you can use the PrintDialog class. The following MSDN pages contains descriptions as well as some sample code:

  • WinForms: System.Windows.Forms.PrintDialog
  • WPF: System.Windows.Controls.PrintDialog (thanks to Bartosz)
like image 120
Heinzi Avatar answered Oct 09 '22 04:10

Heinzi


If you use WPF, you may use PrintDialog: http://msdn.microsoft.com/en-us/library/system.windows.controls.printdialog.aspx

if you're into WinForms you may use...PrintDialog: http://msdn.microsoft.com/en-us/library/system.windows.forms.printdialog.aspx

like image 24
Bartosz Avatar answered Oct 09 '22 04:10

Bartosz