//方法一(推荐): //设置所有行背景色 this.dataGridView1.RowsDefaultCellStyle.BackColor = Color.Violet; //设置奇数行背景色(下标从零开始) this.dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.Blue; //方法二: for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (i % 2 == 0) dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Pink; else dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Violet; }