Finding max width of displayed content

General TRichView support forum. Please post your questions here
Post Reply
csterg
Posts: 306
Joined: Fri Nov 25, 2005 9:09 pm

Finding max width of displayed content

Post by csterg »

Hello Sergey,
i tried to find out the maximum width of the content in TRichView and came up with the following procedure that works find:

Code: Select all

function GetMaxReaderWidth: Integer;
var
  i, maxw, w: Integer;
begin
  maxw := 0;
  with reader.RVData do
  for i:=0 to DrawItems.Count-1 do begin
    w := DrawItems[i].Left + DrawItems[i].Width;
    if w > maxw then maxw := w;
  end;
  result := maxw + reader.LeftMargin + reader.RightMargin;
end;
Do you think it is correct? Will it work also with non-text items and tables?
Thanks,
Costas
Post Reply