ni69
Messages postés1418Date d'inscriptionsamedi 12 juin 2004StatutMembreDernière intervention 5 juillet 201012 6 sept. 2005 à 00:16
Voici le code qu'il te faut :
procedure TForm1.chercheMots;
var
i, StartPos,ToEnd: Integer;
begin
with MemoEleve dobegin
For i := 0 to ListBox1.Items.Count-1 dobegin
Edit1.Text: = ListBox1.Items.Strings[i];
StartPos := -1;
repeat // ON REPETE CE CODE...
ToEnd : = Length(Text) - StartPos;
StartPos := FindText(Edit1.Text,StartPos+1,ToEnd,[stMatchCase]); // Recherche le mot contenu dans Edit1.Text dans le Memo à partir du (StartPos+1)ème caractère
if StartPos <> -1 then begin // Si on a trouvé quelque-chose
SelStart : = StartPos;
SelLength := Length(Edit1.Text);
SelAttributes.Color := clRed; // On colore le texte
end;
until StartPos =-1; // ...JUSQU'A CE QUE StartPos VAILLE -1, C'EST A DIRE QUE LE MOT N'A PAS (OU PLUS) ETE TROUVE DANS LE MEMO
end;
end;
end;
@+
Bonne Prog'
Nico [www.ni69.new.fr]
<hr size="2" width="100%">
N'oubliez pas de cliquer sur Réponse acceptéelorsque la réponse vous convient !