Page 1 of 1

red box in paragraphs

Posted: Wed Aug 18, 2010 6:32 pm
by r1d2m3
Why a box appears red lines around a paragraph?. I remember not defined as a box that appears. Thank you.

Posted: Thu Aug 19, 2010 3:13 pm
by Sergey Tkachenko
Red border around paragraphs occur in documents containing invalid paragraph indices.

For example, if rv.Style.ParaStyles.Count = 3, and you call

Code: Select all

rv.AddNL('hello', 0, 10);
rv.Format;
you will see this red border. This red border is defined in RVStyle.ParaStyles.InvalidItem property.

how to draw a shape, for example, a line or a box?

Posted: Thu Aug 19, 2010 4:04 pm
by r1d2m3
Thanks for the reply. I make another question: how to draw a shape, for example, a line or a box?.

Thank you.

Posted: Thu Aug 19, 2010 5:42 pm
by Sergey Tkachenko
TRichView does not support shapes. If you need a shape in a document, insert it as a picture.
(A horizontal line can be inserted as rvsBreak item)

Posted: Thu Aug 19, 2010 7:36 pm
by r1d2m3
Should be possible to program shapes, lines, boxes, etc, with canvas?

thanks.

Posted: Fri Aug 20, 2010 8:18 am
by Sergey Tkachenko
You can insert TPaintBox component, where you can draw shapes.
On page, you can use OnPagePrepaint/OnPagePostpaint event to draw shapes.
In TRichViewEdit, you can use OnPaint event.

Posted: Fri Aug 20, 2010 7:32 pm
by r1d2m3
As a TPaintBox inserted in a tritchviewedit? Please, if you have an example, I would appreciate. Another question, this TPaintBox inserted, will be released in print the document?

Thank you.

Posted: Sun Aug 22, 2010 8:36 am
by Sergey Tkachenko
http://www.trichview.com/support/files/insertcircle.zip

This example shows 3 ways to insert a figure in TRichViewEdit:
- using TPaintBox component
- using TShape component
- using TMetafile.

As for me, I think using TMetafile is the best method, because it provides a high quality printing.

The current version TRichView does not print components inherited from TGraphicControl, including TPaintBox and TMetafile.
This demo uses OnPrintComponent event to print PaintBox, but cannot print TShape.
In the next TRichView update, it will be able to print any TGraphicControl even without this event.
However, in any case, controls are printed by drawing in a temporal bitmap, then printing this bitmap. Because of this, a printing quality of controls is lower than a printing quality of metafiles.

For simplicity, this demo does not include code necessary to resize and drag inserted controls. See http://www.trichview.com/forums/viewtopic.php?t=157