How do I change the datagridview selected row background color?

后端 未结 6 672
无人共我
无人共我 2020-12-03 13:06

How do I change the datagridview selected row background color in C# windows applications?

6条回答
  •  不思量自难忘°
    2020-12-03 13:46

    This is the simple and working version that you can copy and paste:

    private void dataGridView1_SelectionChanged(object sender, EventArgs e)
    {
        (sender as DataGridView).CurrentRow.DefaultCellStyle.SelectionBackColor = Color.Green;
    }
    

提交回复
热议问题