title: How to set the TMemo height to fill text content in Delphi firemonkey
body: <p>I am using XE7.</p>
  
  <p>I have a TMemo created in runtime.</p>
  
  <p>I need enlarge your height to show all text lines.</p>
  
  <p>I have tried these functions that I found on stackoverflow, but they aren´t working.</p>
  
  <p><code>Memo.height:=get_memo_height(aMemo)</code>
  and
  <code>Memo.height:=ResizeMemo(aMemo)</code></p>
  
  <p>I get height less than real height.</p>
  
  <p>Regards, Luiz</p>
  
  <pre><code>//doesnt work
  function get_memo_height(amemo:tmemo):single;
      var i:integer;
          astring:string;
          layout:ttextlayout;
  
      begin
        Layout := TTextLayoutManager.DefaultTextLayout.Create;
        astring:='';
        for i:=0 to amemo.lines.count-1 do astring:=astring+amemo.lines[i]+chr(10);
        Layout.BeginUpdate;
        Layout.Text :=astring;
        Layout.WordWrap := amemo.wordwrap;
        Layout.HorizontalAlign := amemo.TextAlign;
        Layout.MaxSize := PointF(amemo.width-amemo.ContentBounds.width,maxint);
        Layout.VerticalAlign := tTextAlign.taLeading;
        Layout.Font := amemo.Font;
        Layout.TopLeft := pointf(0,0);
        Layout.EndUpdate;
        result:=layout.textrect.bottom;
        Layout.free;
      end;
  
  
  
      //doesnt work
      function ResizeMemo(AMemo: TMemo):single;
      const
        Offset = 4; //The diference between ContentBounds and ContentLayout
      begin
        result := AMemo.ContentBounds.Height + Offset;
      end;
  </code></pre>