改了下:
{设置行距,单位是像素}
procedure SetLineSpacing(ARichEdit: TRichEdit; LineSpacing:integer);
var
pf2: PARAFORMAT2;
begin
FillChar(pf2, SizeOf(pf2), 0);
pf2.cbSize := SizeOf(PARAFORMAT2);
pf2.dwMask := PFM_LINESPACING;
pf2.dyLineSpacing :=lineSpacing;
pf2.bLineSpacingRule := 5;
SendMessage(ARichEdit.Handle, EM_SETPARAFORMAT, 0, Longint(@pf2));
end;
{获取行距,单位是像素}
function GetLineSpacing(ARichEdit: TRichEdit):integer;
var
pf2: PARAFORMAT2;
begin
FillChar(pf2, SizeOf(pf2), 0);
pf2.cbSize := SizeOf(PARAFORMAT2);
pf2.dwMask := PFM_LINESPACING;
pf2.bLineSpacingRule := 5;
SendMessage(ARichEdit.Handle, EM_GETPARAFORMAT, 0, Longint(@pf2));
result:=pf2.dyLineSpacing;
end;