在RichEdit中搜索

xiaoxiao2026-03-25  1

procedure TFileViewForm.ViewFindDialogFind(Sender: TObject);var  FoundAt: integer;  SearchType: TSearchTypes;beginwith FileViewRE do  begin  if frWholeWord in ViewFindDialog.Options then    SearchType:=[stWholeWord]  else    SearchType:=[];  if SelLength > 0 then    SearchStart:=SelStart + 1  else    SearchStart:=SelStart;  Screen.Cursor:=crHourGlass;  Application.ProcessMessages;  FoundAt:=FindText(ViewFindDialog.FindText, SearchStart, Length(Text),             SearchType);  Screen.Cursor:=crDefault;  Application.ProcessMessages;  if FoundAt < 1 then    MessageDlg('Error! Unable to find "'+ ViewFindDialog.FindText +               '"', mtError, [mbOK], 0)  else    begin    SetFocus;    SelStart:=FoundAt;    SelLength:=Length(ViewFindDialog.FindText);    end;  end;end;

转载请注明原文地址: https://www.6miu.com/read-5046254.html

最新回复(0)