trichview.com

trichview.support




Re: how can remove the zoom event of TRVPrintPreview?


Return to index


Author

Message

Sergey Tkachenko

Posted: 02/15/2003 0:02:50


If you want to draw lines at the same positions on preview and on paper, you

need to use OnPagePrepaint (or OnPagePostpaint).

These events have Canvas of printer resolution (both when printing and when

previewing).


So the main problem is defining coordinates of lines with the mouse. You

need to recalculate coordinates inside the clicked component to the

coordinates on the paper.

It is not a trivial task with TRVPrintPreview component.

I suggest you to use your own component (TPaintBox) instead of

TRVPrintPreview.


Create a PaintBox. Set its size proportional to size of paper (use

properties Preview100PercentWidth and Preview100PercentHeight of TRVPrint).

Use RVPrint.DrawPreview(..., PaintBox.Canvas, ...) to draw page image (on

PaintBox.OnPaint).

When user click at PaintBox at position (X,Y), draw line on PaintBox at

(X,Y), but in OnPagePrepaint at

(PageRect.Left+  X *(PageRect.Right-PageRect.Left) div PaintBox.Width,

(PageRect.Top+  Y *(PageRect.Bottom-PageRect.Top) div PaintBox.Height)






Powered by ABC Amber Outlook Express Converter