查找:
for count0 := 0 to Memo.Lines.Count - 1 do 
begin
  for count1 := 1 to Length(Memo.Lines[count0]) - Length(SearchText) do
  begin
    if SearchText = Copy(Memo.Lines[count0], count1, Length(SearchText)) then 
      Break;
  end;
end;替换的方法类似。

解决方案 »

  1.   

    procedure TForm1.FindDialog1Find(Sender: TObject);
    var
      I, J, PosReturn, SkipChars: Integer;
    begin
      For I := 0 to Memo1.Lines.Count do
      begin
        PosReturn := Pos(FindDialog1.FindText,Memo1.Lines[I]);
        if PosReturn <> 0 then {found!}
          begin
            Skipchars := 0;
            for J := 0 to I - 1 do
              Skipchars := Skipchars + Length(Memo1.Lines[J]);        SkipChars := SkipChars + (I*2);
            SkipChars := SkipChars + PosReturn - 1;
            Memo1.SetFocus;
            Memo1.SelStart := SkipChars;
            Memo1.SelLength := Length(FindDialog1.FindText);
          end;
      end;
    end;
      

  2.   

    TFindDialog组件的FindText的属性的帮助里就有一个非常详细的例子
      

  3.   

    to Delphizhao:
    在例子中有说明:
    Find will only work on sorted lists!