- Offizieller Beitrag
ZitatA number of different methods are provided that allow displaying/printing of a document, including:
<TWPRichText>.Memo.PaintRTFPage
<TWPRichText>.PrintPageOnCanvasand I know there are other methods you provide to print/preview. What are the advantages of one over the other, what are some of the other procedures that allow print/preview, and when and why would you use of the various procedures?
Oh, and let me say one thing. VERSION 5 IS AWESOME!!!!!
- diamond
Thanks for the compliment - I couldn't resist to include it here :-)
In gereneral there is only Memo.PaintRTFPage - this is the procedure which does the job.
The PrintPageOnCanvas procedure which is implemented in unit WPRichCTR is provided to improve the compatibility to version 4. I would not recommend to use it otherwise.
I recommend to use
<TWPCustomRtfEdit>.PaintPageOnCanvas(
PaintPageNr: Integer;
x, y, pw, ph: Integer;
DestCanvas: TCanvas;
PaintMode: TWPPaintModes = [];
DestXRes: Integer = 0;
DestYRes: Integer = 0;
ClipY: Integer = -1;
ClipH: Integer = -1;
PaintPageMode: TWPRTFEnginePaintPagesModes = [wpUseProvidedWidthHeight]): Boolean;
// ClipY and ClipH used internally
// DestXRes, YRes are automatically calculated if 0.
// Otherwise you can use this values to scale the output.
// This are the PaintModes:
TWPPaintModes = set of (
wppPaintHGrid, // Paint grid lines (FGidLinesH, FGridLinesV
wppPaintVGrid,
wppNoImages, // Don't print Images
wppNoObjects, // Don't print objects (such as buttons)
wppNoParShading, // Don't print the colors of shaded paragraph
wppNoTextShading, // Don't print the background color of text
wppAllInGray, // Convert colors in shades of gray
wppWhiteIsTransparent, // Don't print shading in white (or page background)
wppGrayHeaderFooter, // Print the header and footer texts in gray
wppNoHeaderFooter, // Don't print header and footer at all
wppNoWatermarks, // Do not trigger the event to paint the watermarks
wppShowSelection, // Do not highlight the selected text
wppShowGridlines, // Do not display gridlines
wppShowTableRowIndicator, // Do not display the little marker at the end of a table row
wppShowHotStyles, // Do not display text to be 'hot'
wppTextAsBlocks, // Paint text as blocks (quicker in low zooming levels)
wppShowMargins, // Print the margins as dotted lines
wppPrintPageFrame, // Print a frame around the page
wppNoPageBackground, // Paint no white or colored background (usually for printer output)
wppNoPageScaling, // Don't install coordinate transformation before output
wppShowFocusOptional, // Show header/footer area etc
wppOutputToPrinter // Set if the paint function is used for printing
);
// property PaintPageMode should be left alone.
// Possible options are this - for intern use:
TWPRTFEnginePaintPagesModes = set of (
wpDontFreeExternPageRef,
wpDontFreeWatermarkRef,
wpSoftPageBreak,
wpNoXMargins,
wpNoYMargins,
wpUseTextHeight,
wpUseProvidedWidthHeight,
wpDrawFunctionMode // Internal use: ClipY, ClipH is provided by the Draw() function
);
Alles anzeigen