Mirror

How to get the text width and height in a TRichEdit (Views: 100)


Problem/Question/Abstract:

How to get the text width and height in a TRichEdit

Answer:

procedure TForm1.Button3Click(Sender: TObject);
var
  pt: TPoint;
begin
  with RichEdit1 do
  begin
    pt := point(0, 0);
    Perform(messages.EM_POSFROMCHAR, WPARAM(@pt), SelStart);
    label1.caption := Format('(%d, %d)', [pt.x, pt.y]);
  end;
end;

<< Back to main page