Examples Delphi

The windows message EM_SETRECT allows to define a left and/ or right border in a TMemo field.
The following code sets the left border to 20 pixels:

var
Rect : TRect;
begin
SendMessage(Memo1.Handle, EM_GETRECT, 0, LongInt(@Rect));
Rect.Left := 20;
SendMessage(Memo1.Handle, EM_SETRECT, 0, LongInt(@Rect));
Memo1.Refresh;
end;