is my design ok!? (generic print engine)
-
hi , After reading a few articles , i made this printEngine class that derives from PrintDocument. The print engine takes any class that exposes the IPrintableDocument interface. This interface defines a method that supplies a PrintablePage to the exposing class which should fill the page with classes that expose IPrintableSection. Its not very complicated but it does have a few flaws. Like although it _can_ handle pagination , it does'nt do it very well. Could someone please check the code and tell me if the design is ok? And if it needs any improvements? I should mention that i'm a self taught newbie! Heres the code: http://gidsfiles.googlepages.com/PrintingCore.cs[^] http://gidsfiles.googlepages.com/_PrintableSections.cs[^] http://gidsfiles.googlepages.com/PrintTest.cs[^] This is how the print engine is used with the printTest class:
PrintEngine pDoc = new PrintEngine(); pDoc.PrintableDocument = new PrintTest(); PrintDialog prt = new PrintDialog(); prt.Document = pDoc; prt.ShowDialog(); PrintPreviewDialog prev = new PrintPreviewDialog(); prev.Document = pDoc; prev.ShowDialog();
Thanks so much Gideon -
hi , After reading a few articles , i made this printEngine class that derives from PrintDocument. The print engine takes any class that exposes the IPrintableDocument interface. This interface defines a method that supplies a PrintablePage to the exposing class which should fill the page with classes that expose IPrintableSection. Its not very complicated but it does have a few flaws. Like although it _can_ handle pagination , it does'nt do it very well. Could someone please check the code and tell me if the design is ok? And if it needs any improvements? I should mention that i'm a self taught newbie! Heres the code: http://gidsfiles.googlepages.com/PrintingCore.cs[^] http://gidsfiles.googlepages.com/_PrintableSections.cs[^] http://gidsfiles.googlepages.com/PrintTest.cs[^] This is how the print engine is used with the printTest class:
PrintEngine pDoc = new PrintEngine(); pDoc.PrintableDocument = new PrintTest(); PrintDialog prt = new PrintDialog(); prt.Document = pDoc; prt.ShowDialog(); PrintPreviewDialog prev = new PrintPreviewDialog(); prev.Document = pDoc; prev.ShowDialog();
Thanks so much GideonLooks okay.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon