Olá pessoal, através da propriedade AlternatingRowsDefaultCellStyle do DataGridView, estou deixando as linhas zebradas, se eu comentar as linhas do CellFormatting, ficam corretamente zebradas, se não desabilitar prevalece as cores da rotina abaixo, como
faço para deixar o DataGridView zebrado e pintar somente as linhas que eu quero por essa rotina ?
private void dgvRecebidas_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e != null)
{
if (this.dgvRecebidas.Columns[e.ColumnIndex].Name == "DESCTIPOPG")
{
if (dgvRecebidas["DESCTIPOPG", e.RowIndex].Value.ToString().ToUpper().Contains("DEVOLU"))
{
dgvRecebidas.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Yellow;
}
else
{
dgvRecebidas.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Beige;
}
}
}
}
C#, WindowsForm.