Permalink
Browse files

PrintDialog sample

svn path=/trunk/winforms/; revision=60680
  • Loading branch information...
1 parent cc38425 commit 2c71e745a40661e5a34df8f1d4725b9d60881fce Jordi Mas i Hernandez committed May 13, 2006
Showing with 48 additions and 1 deletion.
  1. +4 −1 printing/Makefile
  2. +44 −0 printing/swf-printdialog.cs
View
@@ -2,10 +2,13 @@ all: mono
mono: swf-printing.cs
mcs -debug swf-printing.cs /r:System.Windows.Forms.dll /r:System.Drawing.dll
+ mcs -debug swf-printdialog.cs /r:System.Windows.Forms.dll /r:System.Drawing.dll
dotnet: swf-printing.cs
csc swf-printing.cs /r:System.Windows.Forms.dll /r:System.Drawing.dll
+ csc swf-printdialog.cs /r:System.Windows.Forms.dll /r:System.Drawing.dll
clean:
rm swf-printing.exe -r -f
- rm -f swf-printing.exe.mdb
+ rm swf-printdialog.exe -r -f
+ rm -f swf-printing.exe.mdb
@@ -0,0 +1,44 @@
+//
+// Small sample that brings the PrintDialog
+//
+using System;
+using System.Drawing;
+using System.Drawing.Printing;
+using System.Windows.Forms;
+using System.Runtime.Serialization;
+using System.Runtime.InteropServices;
+using System.ComponentModel;
+
+namespace MyFormProject
+{
+ public class ShowPrintDialog
+ {
+ public ShowPrintDialog ()
+ {
+ }
+
+ static void Main ()
+ {
+ PrintDialog pd = new PrintDialog ();
+
+ pd.AllowSomePages = true;
+ pd.AllowSelection = true;
+ //pd.PrinterSettings = new System.Drawing.Printing.PrinterSettings ();
+ pd.Document = new PrintDocument ();
+ pd.Document.PrinterSettings.FromPage = 20;
+ pd.Document.PrinterSettings.ToPage = 30;
+ pd.Document.PrinterSettings.MaximumPage = 50;
+ pd.Document.PrinterSettings.Copies = 5;
+ pd.ShowHelp = true;
+ pd.ShowNetwork = true;
+ pd.Document.PrinterSettings.PrintRange = PrintRange.SomePages;
+ pd.ShowDialog ();
+
+ Console.WriteLine ("Printer {0}", pd.Document.PrinterSettings);
+ Console.WriteLine ("AllowSomePages {0}", pd.AllowSomePages);
+ Console.WriteLine ("PrintToFile {0}", pd.Document.PrinterSettings.PrintToFile);
+ Console.WriteLine ("PrintRange {0}", pd.Document.PrinterSettings.PrintRange);
+
+ }
+ }
+}

0 comments on commit 2c71e74

Please sign in to comment.