You can adjust line spacing by sending the EM_SETPARAFORMAT
via SendMessage
, setting PFM_LINESPACING
in the dwMask
and providing values for the dyLineSpacing
value (and setting the bLineSpacingRule
value so that the RichEdit knows how to interpret the former). The code below sets a very tight linespacing in the TRichEdit
(the lines actually slightly overlap each other):
procedure TForm1.FormCreate(Sender: TObject);
var
Para: TParaFormat2;
begin
Para.cbSize := SizeOf(Para);
Para.dwMask := PFM_LINESPACING;
Para.bLineSpacingRule := 4; // Use exact twips specified
Para.dyLineSpacing := 120; // Ridiculously small value
SendMessage(RichEdit1.Handle, EM_SETPARAFORMAT, 0, LPARAM(@Para));
end;
For more information, see the MSDN documentation for EM_SETPARAFORMAT