// You can move the caret in a TRichEdit component by using this code :
procedure RichEdit_MoveTo(RichEdit: TRichEdit; LineNumber, CharNumber: Word);
begin
RichEdit.SelStart := RichEdit.Perform(EM_LINEINDEX, LineNumber, 0) + CharNumber);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
RichEdit_MoveTo(RichEdit1,2,5);
Application.ProcessMessages;
RichEdit1.SetFocus;
end;
Bewerten Sie diesen Tipp:
|
|
|