Page 1 of 1

Calculate Line Height

Posted: Thu Apr 10, 2014 5:46 pm
by Jim Knopf
Is there a possibility to calculate the estimated line height before a TRichViewEdit will be filled with data (pure text, no tables, images aso)?

Posted: Sat Apr 12, 2014 10:24 am
by Sergey Tkachenko
You can measure a height of a text item by applying its font to some canvas, then calling Canvas.TextHeight.
To apply a style, call
RVStyle.ApplyStyle(Canvas, StyleNo, rvbdUnspecified, False, True, nil, False, False), where StyleNo = RichViewEdit.GetItemStyle(ItemNo), where ItemNo is an index of the text item.

Posted: Sat Apr 12, 2014 11:49 am
by Jim Knopf
Thanks Sergey, works excellent!