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 entire second row to gray?(or any other color)..
COLUMN1 | COLUMN2
-----------------
black | gray
black | gray
black | gray
Please help.. thanks.
In winform datagrid, right click to view its properties. It has a property called DefaultCellStyle. Click the ellipsis on DefaultCellStyle, then it will present Cell Style Builder window which has the option to change the font size.
The DataGridView control provides a customizable table for displaying data. The DataGridView class allows customization of cells, rows, columns, and borders through the use of properties such as DefaultCellStyle, ColumnHeadersDefaultCellStyle, CellBorderStyle, and GridColor.
DefaultCellStyle property to set these styles for the entire control.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With