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?

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 6:22AM
    it depends upon what your memo contains
    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;
    ;)
  • edited 6:22AM
    but it's not enough and limited
    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
  • edited 6:22AM
    I test it ok at static report but I get data from Variables and despend on Report's OnGetValue event , it is no effect!!

    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??
  • edited 6:22AM
    I moved these codes to OnAfterDataEvent and It works fine

Leave a Comment