Bonjour ,

j'ai cette fonction qui permet d'alterner la couleur de mes lignes de ma listview et le soucis c'est que la couleur de texte ce change pas :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
public void changercouleur()
        {
 
 
            for (
                int i = 0; i < this.Items.Count; i++)
            {
                if (Odd(i) == true)
                {
                    bool b = false;
                    string CodeCommenataire = this.Items[i].SubItems[1].Text;
 
                    b = CodeCommenataire.Contains("COMM");
                    if (b == true)
                    {
                        this.Items[i].BackColor = Color.FromArgb(176, 128, 106); ;
                        this.Items[i].SubItems[1].ForeColor = System.Drawing.Color.Red;
                        MessageBox.Show(this.Items[i].SubItems[1].ForeColor.ToString());
                        this.Items[i].SubItems[1].Text = "coucou";
                       //this.Items[i].SubItems[1].
                    }
                    this.Items[i].BackColor = Color.FromArgb(176, 128, 106); ;
                }
                else
                {
                    bool b = false;
                    string CodeCommenataire = this.Items[i].SubItems[1].Text;
 
                    b = CodeCommenataire.Contains("COMM");
                    if (b == true)
                    {
                        this.Items[i].SubItems[1].ForeColor = Color.FromArgb(192, 218, 82);
                    }
                    this.Items[i].BackColor = Color.FromArgb(192, 218, 82);
                }
 
 
            }
 
        }
Merci de votre coup de pouce