Change Font Color of a Column in a DataGridView Control (C# winforms)
I have a DataGridView
control with two columns. The default color of the text is black. Is it possible to set the fore color of the entir开发者_如何学运维e second row to gray?(or any other color)..
COLUMN1 | COLUMN2
-----------------
black | gray
black | gray
black | gray
Please help.. thanks.
Your subject and question are confusing, one refers to the column and one to the rows but anyway.
grid.Columns[1].DefaultCellStyle.ForeColor = Color.Gray;
should handle the column color.
grid.Rows[1].DefaultCellStyle.ForeColor = Color.Gray;
should handle the row color.
dgv.Rows[1].DefaultCellStyle.ForeColor = Color.Gray;
or Columns[1]
, if that's what you meant.
精彩评论