Set margins in a TMemo (Views: 31)
Problem/Question/Abstract: How to set margins in a TMemo Answer: EM_SETRECT message is sent to Memo to fix the size of the canvas of the component. procedure TForm1.Button1Click(Sender: TObject); var R: TRect; LeftMargin: integer; RightMargin: integer; begin LeftMargin := 20; RightMargin := 10; R := Memo1.ClientRect; R.Left := R.Left + LeftMargin; R.Top := R.Top + 2; R.Bottom := R.Bottom - 2; R.Right := R.Right - RightMargin; SendMessage(Memo1.Handle, EM_SETRECT, 0, Longint(@R)); end; |