[Mono-dev] [PATCH] Use the correct type for S.D.Printing.PrintDocument.PrintController
Carlos Alberto Cortez
calberto.cortez at gmail.com
Fri Aug 4 14:13:28 EDT 2006
Hey,
I tried your sample with .Net 2.0, and got:
controller = System.Windows.Forms.PrintControllerWithStatusDialog
Probably in .Net 1.1 it's handled different (if you are using that
version, of course).
Carlos.
El mié, 02-08-2006 a las 07:45 -0400, Chris Toshok escribió:
> this doesn't work unless System.Windows.Forms is being used, it appears.
>
> The following test:
>
> using System;
> using System.Drawing;
> using System.Drawing.Printing;
>
> public class Foo {
> public static void Main (string[] args) {
> PrintDocument doc = new PrintDocument ();
>
> Console.WriteLine ("controller = {0}",
> doc.PrintController.GetType());
> }
> }
>
> outputs:
>
> controller = System.Drawing.Printing.StandardPrintController
>
> Chris
>
> On Wed, 2006-08-02 at 04:30 -0500, Carlos Alberto Cortez wrote:
> > Hey,
> >
> > S.D.Printing.PrintDocument.PrintController has as default a new instance
> > of S.W.F.PrintControllerWithStatusDialog, which is in SWF assembly.
> >
> > The current code assigns a new instance of S.D.P.StandardPrintController
> > to PrintDocument.PrintController, which isn't the right behaviour.
> >
> > The problem is that it's not a good idea to add System.Windows.Forms as
> > a reference to the System.Drawing assembly IMHO. So, the approach is to
> > load the SWD assembly using reflection and then cache the type .ctor.
> >
> >
> > Also, PrintDocument.PrintController should be never null, and should get
> > a new PrintControllerWithStatusDialog instance, just like .Net does.
> >
> > Carlos.
>
More information about the Mono-devel-list
mailing list