Page 1 of 1

Finding max width of displayed content

Posted: Sat Jan 07, 2006 3:47 pm
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