Mega Code Archive

 
Categories / Delphi / VCL
 

Define a border for Memos

Title: Define a border for Memos? { The EM_SETRECT message sets the formatting rectangle of a multiline edit control. The formatting rectangle is the limiting rectangle into which the control draws the text. Mit der EM_SETRECT Nachricht kann man die Ränder in Memo-Feldern festlegen. } procedure TForm1.Button1Click(Sender: TObject); const BORDER_WIDTH = 20; var Rect: TRect; begin SendMessage(Memo1.Handle, EM_GETRECT, 0, Longint(@Rect)); Rect.Top := BORDER_WIDTH; Rect.Left := BORDER_WIDTH; Rect.Right := Memo1.Width - BORDER_WIDTH; Rect.Bottom := Memo1.Height - BORDER_WIDTH; SendMessage(Memo1.Handle, EM_SETRECT, 0, Longint(@Rect)); Memo1.Refresh; end;