更改DataGridView控件中列的字体颜色(C#winforms)

yon*_*236 6 c#

我有一个DataGridView有两列的控件.文本的默认颜色为黑色.是否可以将整个第二行的前色设置为灰色?(或任何其他颜色)..

    COLUMN1 | COLUMN2
    -----------------
     black  | gray
     black  | gray
     black  | gray
Run Code Online (Sandbox Code Playgroud)

请帮忙..谢谢.

Gar*_*ary 9

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;
Run Code Online (Sandbox Code Playgroud)

should handle the column color.

grid.Rows[1].DefaultCellStyle.ForeColor = Color.Gray;
Run Code Online (Sandbox Code Playgroud)

should handle the row color.