trichview.com

trichview.support




Re: Canvas


Return to index


Author

Message

Sergey Tkachenko

Posted: 01/31/2002 23:39:43


The simplest (but worst way) is using

RichView.RVData.PaintTo(Canvas, Rect(0,0,$FFFFFFF,$FFFFFFF)).

RichView must have desired width, and should be scrolled to the beginning of

document.

Inserted controls will not be drawn.


The best way is to use (undocumented) component TRVReportHelper.

This component is very similar to TRVPrint, but

- stores RVF document (not a reference to it)

- allows to draw/print on any canvas in rectangle(s) of any sizes.


Example of using:


  // assigning properties and events of TRVReportHelper

  // these assignments can be done in design time only in Delphi 6

  helper.RichView.OnRVFImageListNeeded := helperRichViewRVFImageListNeeded;

  helper.RichView.Style := RVStyle1;


  // allowing loading of these classes from RVF files

  RegisterClasses([TEdit, TButton]);

  // loading demo file

  helper.RichView.LoadRVF('readme.rvf');


// formatting

  helper.Init(Canvas, Width);

  while helper.FormatNextPage(Height) do;


where

Canvas - canvas to paint onto

Width - width of output rectangle

Height - maximal height of "page" (frame). If you set Height to very large

value, all document will be drawn on one "page" (if it does not have page

breaks).


After that you can paint

helper.DrawPage(PageNo, Canvas, True, Height);


where PageNo - number of page (from 1).

Left top corner of "page" will be in (0,0), use SetViewportOrgEx to move it

to another location.


If you need an example, I can post it here.





> How to transform a RVF file to Canvas ?





Powered by ABC Amber Outlook Express Converter