So do you confirm - it's the first call of FormatPages() which may take a lot of time, and subsequent calls are not slower than reformatting on the screen?
TRichView does nothing special but reads printer properties from the system and creates device context compatible to the printer. The initialization is performed by Windows.
Well, I do not know, you can try to create a hidden preview of empty document when the application is idle...
I've found the source of problem - tables drawing!!!
If document doesnt containt tables - previewing of 15 pages takes less than 1 second, but if it does - a lot of time!!!
Создана ссылка на файл!
webfile.ru/578079
Имя файла - test_rvf.rar , размер 15 Кбайт. Файлу присвоен номер 578079, он будет доступен до 24.10.2005 16:46.
2 files in rar archive:
fast_13pages_text.rvf - 13 pages text with formatting only
slow_3pages_tables.rvf - 3 pages with tables
It's no surprise that the second document's preview redrawing is slower. It has a complex layout with a lot of tables and small text.
There is a way to speed up the preview: set RVPrintPreview.CachePageImage to True (but do it only when running on WinXP, problems were reported on some Win9x computers).
In this mode, the page image is rendered in a metafile, and this metafile is shown in preview.
HighTower wrote:I've found the source of problem - tables drawing!!!
If document doesnt containt tables - previewing of 15 pages takes less than 1 second, but if it does - a lot of time!!!
I use RichView for tables me too, and it's very slow :
for a file with 500 pages of tables, it works 5 minutes.
To HighTower:
If RVPrintPreview.CachePageImage=False, no caching is used, and a trichview page-painting procedure is called on each repainting of the preview.
If RVPrintPreview.CachePageImage=True, the current page is rendered into a metafile, and then this metafile is drawn, so the trichview page-painting procedure is called only one time per page, when this page is shown for the first time. Only one page is cached. When you switch the preview to another page, a metafile is recreated. This metafile is also recreated after changing zooming percent.
So the initial displaying of each page in the caching mode may be even slower (time for creating metafile + time for drawing metafile), but scrolling will be faster.
To Benoit B.:
Try to optimize your document. For example, instead of using one huge table, try to use several smaller tables.
It's possible to make a very fast preview by drawing a page image in bitmap, and then showing this bitmap.
You can do it yourself, using RVPrint.MakeScaledPreview method.