DataGridViewCellStyle MonStyle = new DataGridViewCellStyle(dataGridView2.Rows[1].DefaultCellStyle);//je recupère un styles existant MonStyle.BackColor = Color.Red;// je le modifie comme je veux MonStyle.ForeColor = Color.White; MonStyle.SelectionBackColor = Color.Salmon; dataGridView2.Rows[2].DefaultCellStyle = MonStyle;//je l'applique à ma ligne
foreach (DataGridViewRow row in dataGridView2.Rows) { DataGridViewCell Cellule = row.Cells["Genre"]; if (Cellule.Value == null) return; if (Cellule.Value.ToString() == "Homme") Cellule.Style.ForeColor = Color.Blue; else Cellule.Style.ForeColor = Color.Purple; }
string genre = ""; DataGridViewCellStyle MonStyle = new DataGridViewCellStyle(dataGridView2.Columns[4].DefaultCellStyle); foreach (DataRow row in cb.monDataTable1.Rows) { genre = row["Genre"].ToString(); if (genre == "Homme") { MonStyle.ForeColor = Color.Blue; dataGridView2.Columns[4].DefaultCellStyle = MonStyle; } else { MonStyle.ForeColor = Color.Purple; dataGridView2.Columns[4].DefaultCellStyle = MonStyle; } }
foreach (DataGridViewRow row in dataGridView2.Rows) { DataGridViewCellStyle MonStyle = new DataGridViewCellStyle(dataGridView2.Columns[0].DefaultCellStyle); DataGridViewCell Cellule = row.Cells["Genre"]; if (Cellule.Value == null) return; if (Cellule.Value.ToString() == "Homme") { MonStyle.ForeColor = Color.Blue; Cellule.Style = MonStyle; } else { MonStyle.ForeColor = Color.Purple; Cellule.Style = MonStyle; } }
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.