Home General

Determine space used by memo

edited August 2001 in General
Hi guys,

This was answered before and below is the example code I've got. At that
time I had RB5.0 and was told that this code works with 5.5. Now I have 6.01
and this code still doesn't work. It just changes the font size of every
other record(???), not the ones that doesn't fit into predetermined size
(FSpaceAvailable).

Does anyone have any ideas?

Thanks.

Zoran.

--------------
procedure TForm1.ppDetailBand1BeforePrint(Sender: TObject);
begin
ppMemo1.Lines.Clear;
ppMemo1.Lines.Add(plCustomer['Company']);
ppMemo1.Lines.Add(plCustomer['Addr1']);
ppMemo1.Lines.Add(plCustomer['City']);
ppMemo1.Lines.Add(plCustomer['Country']);

ppMemo1.Font.Size := FDefaultFontSize;
ppMemo1.CalcSpaceUsed;

repeat
ppMemo1.CalcSpaceUsed;
if ppMemo1.SpaceUsed > FSpaceAvailable then
begin
ppMemo1.Font.Size := ppMemo1.Font.Size - 1;
messagebeep(0);
end;
until (ppMemo1.Font.Size = 1) or (ppMemo1.SpaceUsed <= FSpaceAvailable);
Table1.Next;
end;

Comments

This discussion has been closed.