Calculate Line Height

General TRichView support forum. Please post your questions here
Post Reply
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Calculate Line Height

Post 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)?
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Post by Jim Knopf »

Thanks Sergey, works excellent!
Post Reply