对不起,记错了一个内容,Richedit2.0已经直接支持行间距。因为Delphi自带的TRichedit
不支持RichEdit2.0,所以必须用其他的代替。下例中用了TRxRichEdit:
procedure TfrmMain.ChangeLineSpace;
var
liS, liL: longint;
begin
SendMessage(RxRichEdit1.Handle, WM_SETREDRAW, 0, 0);
try
with RxRichEdit1 do begin
liS := SelStart;
liL := SelLength;
SelectAll;
Paragraph.LineSpacing := Round(iiLineSpace * SelAttributes.Size); //iiLineSpace为行间距
Paragraph.LineSpacingRule := lsSpecifiedOrMore;
SelStart := liS;
SelLength := liL;
Modified := False;
end;
finally
SendMessage(RxRichEdit1.Handle, WM_SETREDRAW, -1, 0);
RxRichEdit1.Invalidate;
end;
end;