how to change the font' size to fit frxmemoviem
The frxmemoview's stretchmode was setted smdontstretch and countnot to be changed,and the content would be auto fit the memo,
how to change the font'size based on the contents length and auto wordwrap?
how to change the font'size based on the contents length and auto wordwrap?
Comments
ie [datafield] or [variable] or [expression] or just text.
assuming it contains one of the first 3 above
use obp event of either memo or band, write code using the lengthfunction to test the contents of the data field in a case statement using some ranges to set the memos font.fontsize property.
begin
case [length(<dataset."fieldname">] of
1..10: memo1.font.fontsize := 10;
11..20: memo1.font.fontsize := 8;
else
memo1.font.fontsize := 6;
end;
i want to have a genaral procedue to set it
eg. adjust the frxcustommemoview 's width or height on the memo
because contans maybe are multi-linse but not a bigger length
procedure TMemo1.OnBeforePrint(Sender: TfrxComponent)
begin
while (TfrxMemoView(Sender).CalcHeight>TfrxMemoView(Sender).Height) do
begin
TfrxMemoView(Sender).Font.Size := TfrxMemoView(Sender).Font.Size-1;
end;
end;
why??