Unit Print_preview

This code is based on the code provided as ryPrev32 by Ry http://public.usit.net/rpetersn rpetersn@usit.netunit he wrote This is an example of a a print preview system based on EMFs With source. It will only work with Delphi 2 as it uses Enhanced Metafiles I only ask that you give me some feedback if you like it, hate it, or have some improvements. /////////////////////////////////////////////////////////////////////////////// Heavily modified and almost totally redesigned by John Biddiscombe J.Biddiscombe@rl.ac.uk - Freeware. Original code use a single metafile to store each page, this new code allows multiple objects within pages and thus resizing of each via the strechhandles. To make this work, I needed to use a windowed control, which I could add child windows to, since the strechhandles need a control to latch on to. Created TSingle_page object to contain each page metafiles list. the Fmetafiles contains the individual objects and the Fmetafile contains the final print that goes to the printer it is only used at the final stage - created on request... since every time you change the print setup, or move any objects or add any, it needs to be redrawn. I also use it to show the mini preview in the dialogsetupbox, but only as a rough guide since we'd need to add more callbacks to continually change the metafile with every margin, paper change etc etc. The original code had a paintbox, but it is a nonwindowd control, so can't have any child controls. I needed a simple box, like a panel, but with a canvas, which is why I've made the TPanelWithCanvas The PanelWithCanvases are created at runtime, so do not need to be installed on the component palette. ///////////////////////////////////////////////////////////////////////////////

Classes

TPrintout - Public declarations
TPrintPreview_form -
Tsingle_page -

Functions

Types

double_rec

Constants

Variables

Margin_Size_inches
Margin_Size_pixels
Margin_Size_pixels2
PageSize_inches
PageSize_pixels
Printer_ppi
Screen_ppi


Functions


Types


double_rec = record
x : double;
y : double;
end;
Mine

Constants


Variables

Margin_Size_inches : double_rec

right,bottom

Margin_Size_pixels : TPoint

Margin_Size_pixels2 : TPoint

left, top

PageSize_inches : double_rec

PageSize_pixels : TPoint

Printer_ppi : TPoint

Screen_ppi : TPoint