//需要提醒得是我得程序调用此过程非常频繁 5times/second<br>procedure TPrintOutForm.AddPrintOutText(sText:string);<br>var<br> i:integer;<br> TempStrings:TStringList;<br>begin<br> try<br> PrintOutRichEdit.SelStart:=Length(PrintOutRichEdit.Text)-1;<br> PrintOutRichEdit.SelLength:=1;<br> PrintOutRichEdit.SelText:=sText+' ';<br><br> if (PrintOutRichEdit.Lines.Count>fMaxLine) then<br> begin<br> TempStrings:=TStringList.Create;<br> try<br> TempStrings.Clear;<br> TempStrings.AddStrings(PrintOutRichEdit.Lines);<br> for i:=0 to (fMaxLine div 2) do<br> TempStrings.Delete(0);<br> PrintOutRichEdit.Clear;<br> PrintOutRichEdit.Lines.AddStrings(TempStrings);<br> except<br> PrintOutRichEdit.Clear;<br> end;<br> TempStrings.Free;<br> end;<br> SendMessage(PrintOutRichEdit.Handle,EM_ScrollCaret,0,0);<br> except<br> on Exception do ShowMessage('PrintOut Error');<br> end;<br>end;<br>