[Mono-dev] [PATCH] Use the correct type for S.D.Printing.PrintDocument.PrintController

Chris Toshok toshok at ximian.com
Wed Aug 2 07:45:17 EDT 2006


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