trichview.com

trichview.support




Re: Question on TRvHelper example and preview


Return to index


Author

Message

zet

Posted: 04/01/2003 17:06:14


Sergey Tkachenko wrote:


> The only small problem: you cannot use RVReportHelper.DrawPageAt, because it

> sets offset of left-top corner of the document in pixels of device (screen,

> in this case), using SetViewportOrgEx. But we need to set it in logical

> coordinates. What's why this code uses SetWindowOrgEx +

> RVReportHelper.DrawPage (coordinates of left-top corner are passed to

> SetWindowOrgEx with minus sign).

Well, does it mean that we still can't preview documents with 2 columns?



> Btw, this code had a small bug (that also presents in the original demo) -

> it forgets to clear document before loading, so it appends new RTF file to

> the previously loaded instead of replacing it.


Actually there was another bug in code.


It looked like this:

     SetWindowOrgEx(Canvas.Handle, -DocLeft, -HeaderTop, @pt);

     rvh2.DrawPage(1, Canvas, True, rvh2.EndAt);

     SetWindowOrgEx(Canvas.Handle, -DocLeft, -DocTop, @pt); // @pt

replaced by new value

     rvh.DrawPage(PageNo, Canvas, True, DocHeight);

     SetWindowOrgEx(Canvas.Handle, pt.x, pt.y, nil);


And that's how it should look:

     SetWindowOrgEx(Canvas.Handle, -DocLeft, -HeaderTop, @pt);

     rvh2.DrawPage(1, Canvas, True, rvh2.EndAt);

     SetWindowOrgEx(Canvas.Handle, -DocLeft, -DocTop, nil); // @pt is safe

     rvh.DrawPage(PageNo, Canvas, True, DocHeight);

     SetWindowOrgEx(Canvas.Handle, pt.x, pt.y, nil);


Now it works excellent. Thanks again for idea ;)


Sergey Tkachenko wrote:

> Well, probably.

> TRVPrintPreview was seriously changed since 1.7

Can you mail me with location of sourcecode of version 1.7.10?





Powered by ABC Amber Outlook Express Converter