All pastes #757750 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-11-01 16:03 UTC
rendered paste body
Index: System.Drawing.Printing/PreviewPrintController.cs
===================================================================
--- System.Drawing.Printing/PreviewPrintController.cs   (revision 88552)
+++ System.Drawing.Printing/PreviewPrintController.cs   (working copy)
@@ -5,11 +5,8 @@
 //   Dennis Hayes (dennish@Raytek.com)
 //
 // (C) 2002 Ximian, Inc
+// Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com)
 //
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // "Software"), to deal in the Software without restriction, including
@@ -78,17 +75,17 @@
                [MonoTODO]
                public override Graphics OnStartPage(PrintDocument document, PrintPageEventArgs e)
                {
-                       Image image = new Bitmap (e.PageSettings.PaperSize.Width, e.PageSettings.PaperSize.Height);
-
-                       PreviewPageInfo info = new PreviewPageInfo (image, new Size (e.PageSettings.PaperSize.Width,
-                                                                                    e.PageSettings.PaperSize.Height));
-
-                       pageInfoList.Add (info);
-
-                       Graphics g = Graphics.FromImage (info.Image);
-                       g.FillRectangle (new SolidBrush (Color.White), new Rectangle (new Point (0,0), new Size (image.Width, image.Height)));
-
-                       return g;
+                       PaperSize ps = e.PageSettings.PaperSize;
+                       Bitmap b = new Bitmap (ps.Width, ps.Height);
+                       b.SetResolution (e.PageSettings.PrinterResolution.X, e.PageSettings.PrinterResolution.Y);
+
+                       PreviewPageInfo info = new PreviewPageInfo (b, new Size (ps.Width, ps.Height));
+                       pageInfoList.Add (info);
+
+                       Graphics g = Graphics.FromImage (info.Image);
+                       g.Clear (Color.White);
+
+                       return g;
                }

                public virtual bool UseAntiAlias {