fabiin
Messages postés329Date d'inscriptionmercredi 4 avril 2001StatutMembreDernière intervention 8 décembre 2009
-
12 juin 2002 à 19:36
fabiin
Messages postés329Date d'inscriptionmercredi 4 avril 2001StatutMembreDernière intervention 8 décembre 2009
-
12 juin 2002 à 22:23
Salut
Voila, g un RichTextbox
et je voudrai colorier tous les Mots "bonjour" de celui-ci
je sais qu'il fut utiliser
SelAtribute.color
mais je c pas pour que ca y fasse a tous les mots "bonjour" du texte
cs_Nono40
Messages postés962Date d'inscriptionmercredi 3 avril 2002StatutMembreDernière intervention12 septembre 20062 12 juin 2002 à 22:12
Tu cherches qque chose comme ça il me semble :
procedure TForm1.Button3Click(Sender: TObject);
var
StartPos,FoundAt: LongInt;
begin
with RichEdit1 do
begin
StartPos:=0;
Repeat
FoundAt := FindText('bonjour', StartPos, Length(Text)-StartPos, [stMatchCase]);
if FoundAt <> -1 then
begin
SetFocus;
SelStart := FoundAt;
SelLength := Length('bonjour');
SelAttributes.Color := clRed;
StartPos := FoundAt+1;
end;
Until FoundAt=-1
end;
end;