Board index » delphi » Printing the Paintbox
George Kuascha
![]() Delphi Developer |
George Kuascha
![]() Delphi Developer |
Printing the Paintbox2007-02-27 08:03:10 AM delphi194 Can someone show me some code on how to print objects on the paintbox? The paintbox in my application has some objects scrolled off the screen, therefore I cannot capture the screen into a bitmap. |
Joe C. Hecht
![]() Delphi Developer |
2007-02-28 02:43:41 AM
Re:Printing the Paintbox
Our TExcellentFormPrinter product can print the full PaintBox
contained on a Form or ScrollBox control to any size you wish, including pre-scaled to fit a page, or even printed across multiple pages. TExcellentFormPrinter canbe found here: www.code4sale.com/joehecht/index.htm Joe -- Delphi, graphics, and printing specialist available - $35/hr www.code4sale.com/codeit/index.htm Joe Hecht "George Kuascha" <XXXX@XXXXX.COM>writes news:XXXX@XXXXX.COM... QuoteCan someone show me some code on how to print objects on the paintbox? The |
Peter Below (TeamB)
![]() Delphi Developer |
2007-02-28 02:59:50 AM
Re:Printing the Paintbox
George Kuascha writes:
QuoteCan someone show me some code on how to print objects on the handler you call this method with the paintbox.Canvas and the paintbox.ClientRect as parameters. Of course you need to recode the drawing stuff to remove any references to the paintbox object, the drawing code should only use the passed parameters. You can now call the same method using the printer.canvas and a rect constructed from the printer.pagewidths and pageheight. You can also call it with a bitmap.canvas or a metafilecanvas. There is a fly in this ointment, however: the paintbox canvas and the printer canvas will have very different resolution (pixels or dots per inch). If you draw using device units (pixel coordinates) the output on the printer canvas will be much smaller than you would like it. The solution to this dilemma is to use device-independent units for positions and sizes, e.g. twips (1/1440 inch = 1/20 point) or 1/100 mm. You can either handle the conversions between these units and the device units yourself (simply math but cumbersome, use the GetDeviceCaps API function with the canvas.handle and LOGPIXELS_X/Y to get the resolution in dots per inch), or you can use the SetMapMode API function to define a mapping that will make Windows do the conversion for you. YOu have to set the canvas.font.pixelsperinch value to the proper value (1440 for twips, for example) to get the correct font sizes when you set the font.size property (which uses points as units). -- Peter Below (TeamB) Don't be a vampire (slash7.com/pages/vampires), use the newsgroup archives : www.tamaracka.com/search.htm groups.google.com www.prolix.be |