var
Ls, I : integer;
begin
Ls := RichEdit1.Lines.Count;
if Ls<RichEdit2.Lines.Count then Ls := RichEdit2.Lines.Count;
for I := 0 to Ls-1 do begin
if (I <= RichEdit1.Lines.Count)
and (I <= RichEdit2.Lines.Count)
and (RichEdit1.Lines[I] = RichEdit2.Lines[I])
then else begin
if I <= RichEdit1.Lines.Count then begin
RichEdit1.SelStart := SendMessage(RichEdit1.Handle, EM_LINEINDEX, I, 0);
RichEdit1.SelLength := Length(RichEdit1.Lines[I]);
RichEdit1.SelAttributes.Style := [fsBold];
end;
if I <= RichEdit2.Lines.Count then begin
RichEdit2.SelStart := SendMessage(RichEdit2.Handle, EM_LINEINDEX, I, 0);
RichEdit2.SelLength := Length(RichEdit2.Lines[I]);
RichEdit2.SelAttributes.Style := [fsBold];
end;
end;
end;
end;
比对是可以的,就
procedure TForm1.Button1Click(Sender: TObject);
var
i,k:integer;
str1,str2:string;
begin
for i:=0 to memo1.Lines.Count-1 do
begin
str1:=memo1.Lines[i];
str2:=memo2.Lines[i];
if str1 <> str2 then
showmessage(inttostr(i));
end;
end;
做标记不太容易,没什么好办法.