OnResizeRequest (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following code resizes the rich edit control to accommodate growing or shortening lines of text. This example requires a button, a TEdit, and a TRichEdit. Double-click the TRichEdit OnResizeRequest event to create the event handler.

Code

procedure TForm1.Button1Click(Sender: TObject);
begin
  RichEdit1.Lines.Add(Edit1.Text);
end;

procedure TForm1.RichEdit1ResizeRequest(Sender: TObject; Rect: TRect);
begin
  (Sender as TRichEdit).BoundsRect := Rect;
end;

Uses