Jump to content

UniMemo AutoSize


skafy

Recommended Posts

Hi,

 

how can i make memo with autosize when text wrap. I would like memo with 1 line and than when wordwrap happens i would like to increase memo height for 1 line. I've tried code from another post seen below, but doesn't seems to be accurate:

function TPaginaPrincipal.TextWidth(s: TUniLabel): Integer;
var
  c: TBitmap;
  f: TFont;
begin
{ uma forma de calcular o tamanho de um texto na janela se o canvas não atualiza via ajax }
  c := TBitmap.Create;
  f := TFont.Create;
  Result := 8 * Length(s.Caption);
  f.Height := s.Font.Height;
  f.Size := s.Font.Size;
  f.Name := s.Font.Name;
  f.Style := s.Font.Style;
  try
    c.Canvas.Font.Assign(f);
    Result := c.Canvas.TextWidth(s.Caption);
  finally
    c.Free;
  end;
end;

How can I accomplish this?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...