how to put this line at the end of the text according to the space remaining to end the page?

Code: Select all
procedure TForm3.SRichViewEdit1PaintPage(Sender: TObject; PageNo: Integer;
PageRect, R: TRect; Canvas: TCanvas; Prepaint, Printing: Boolean);
var srv: TSRichViewEdit;
pt: TPoint;
FirstPageNo, LastPageNo: Integer;
ItemRect: TRect;
begin
srv := Sender as TSRichViewEdit;
if Prepaint or (PageNo<srv.PageCount) then
exit;
pt.X := PageRect.Left + srv.LeftMargin100Pix;
srv.GetItemBounds100(srv.RichViewEdit.RVData, srv.RichViewEdit.ItemCount-1,
ItemRect, FirstPageNo, LastPageNo, -1);
pt.Y := PageRect.Top+ItemRect.Bottom;
Canvas.Pen.Color := clBlack;
Canvas.Pen.Width := 1;
Canvas.Pen.Style := psSolid;
Canvas.MoveTo(pt.X, pt.Y);
pt.X := PageRect.Right - srv.RightMargin100Pix;
pt.Y := PageRect.Bottom - srv.BottomMargin100Pix;
Canvas.LineTo(pt.X, pt.Y);
end;
Code: Select all
procedure TForm3.SRichViewEdit1Change(Sender: TObject);
begin
SRichViewEdit1.UpdateBuffer;
end;