How to change the color of winform DataGridview header?

后端 未结 5 935
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-28 07:26

I have tried to do it without success.

Is it possible ?

5条回答
  •  南笙
    南笙 (楼主)
    2020-11-28 07:57

    If you want to change a color to single column try this:

     dataGridView1.EnableHeadersVisualStyles = false;
     dataGridView1.Columns[0].HeaderCell.Style.BackColor = Color.Magenta;
     dataGridView1.Columns[1].HeaderCell.Style.BackColor = Color.Yellow;
    

提交回复
热议问题