Don0Choa
Messages postés104Date d'inscriptiondimanche 29 octobre 2000StatutMembreDernière intervention12 décembre 2005
-
4 oct. 2002 à 19:50
Don0Choa
Messages postés104Date d'inscriptiondimanche 29 octobre 2000StatutMembreDernière intervention12 décembre 2005
-
6 oct. 2002 à 19:06
Bonjour , j'ai plusieur questions:
1)Comment trier du texte dans une list box selon le sex de la personne(texte de la list) le sexe est retenu par une string.?
2)Voila quand je recoi un texte dans le richedit jai ca:
pseudo+phrase
ces 2 choses etan des trings, jarrive a colorer la ligne selon se ke je recoi, mais comment fair pour colorer le Pseudo ET la phrase, mais de couleur differentes?
3)comment fair un dégrader de couleur(moin important ce n'ets pas une priorité.
cs_Nono40
Messages postés962Date d'inscriptionmercredi 3 avril 2002StatutMembreDernière intervention12 septembre 20062 5 oct. 2002 à 15:47
Voici un petit exemple :
procedure TForm1.Button1Click(Sender: TObject);
Var Debut : Integer;
Fin : Integer;
Trouve : Integer;
begin
With RichEdit1 Do
Begin
SelAttributes.Color := clRed;
Lines.Add('Pseudo');
SelAttributes.Color := clBlack;
SelText:='+';
// Mémorisation du début de la "phrase"
Debut :=SelStart;
// Ajout de la phrase
SelAttributes.Color := clLime;
SelText:='Phrase Mot Phrase Mot Phrase Mot';
// Recherche de la première occurence
Fin :=Length(Text)-Debut;
Trouve:=FindText('Mot',Debut,Fin,[stWholeWord]);
While Trouve>=0 Do
Begin
// Sélection de l'occurence trouvée
SelStart :=Trouve;
SelLength :=Length('Mot');
// Ajout de l'attibut gras
SelAttributes.Style:=SelAttributes.Style+[fsBold];
// Recherche du suivant
Debut :=Trouve+1;
Fin :=Length(Text)-Debut;
Trouve :=FindText('Mot',Debut,Fin,[stWholeWord]);
End;
// Retour en police normale
SelStart:=Length(Text);
SelAttributes.Style:=SelAttributes.Style-[fsBold];
End;
end;
Don0Choa
Messages postés104Date d'inscriptiondimanche 29 octobre 2000StatutMembreDernière intervention12 décembre 2005 6 oct. 2002 à 13:30
Voila ca marche presque bien j'ai un tt petit bug, parfoi le pseudo se color de la couleur de la phrase précédente, e par moment ca me color tt les phrase de la meme couleur ,pseudo y compri. j'ai :
Begin
With Sc.RichEdit1 Do
If (Sexe='H') then
Sc.Richedit1.SelAttributes.Color := clBlue;
If (Sexe='X') then
Sc.Richedit1.SelAttributes.Color := clOlive;
If (Sexe='F') then
Sc.Richedit1.SelAttributes.Color := $008306FF;
If (Sexe='M') then
Sc.Richedit1.SelAttributes.Color := clGreen;
If (Sexe='A') then Sc.Richedit1.SelAttributes.Color := ClRed;
SC.richedit1.SelAttributes.Size:=9;
Sc.Richedit1.Lines.Add(Pseudo+'>');
If (Color='0') then SC.richedit1.SelAttributes.Color:=ClBlack;
If (Color='1') then SC.richedit1.SelAttributes.Color:=ClNavy;
If (Color='2') then SC.richedit1.SelAttributes.Color:=ClBlue;
If (Color='3') then SC.richedit1.SelAttributes.Color:=ClTeal;
If (Color='4') then SC.richedit1.SelAttributes.Color:=ClGreen;
If (Color='5') then SC.richedit1.SelAttributes.Color:=$0000D500;
If (Color='6') then SC.richedit1.SelAttributes.Color:=$000000AA;
If (Color='7') then SC.richedit1.SelAttributes.Color:=ClRed;
If (Color='8') then SC.richedit1.SelAttributes.Color:=$001188FF;
If (Color='9') then SC.richedit1.SelAttributes.Color:=$00972FFF;
If (Color='A') then SC.richedit1.SelAttributes.Color:=$009F009F;
If (Color='B') then SC.richedit1.SelAttributes.Color:=ClOlive;
If (Color='C') then SC.richedit1.SelAttributes.Color:=ClGray;
If (Style='C') then SC.richedit1.SelAttributes.Color:=clPurple;
If (Style='P') then SC.richedit1.SelAttributes.Size:=9;
If (Style='H') then SC.richedit1.SelAttributes.Size:=12;
If (Style='M') then SC.richedit1.SelAttributes.Size:=7;