Row separator color in datagridview

I have a winforms datagridview (C #) where I can set the separator between rows with row.DividerHeight = 1

But I would like to change the color of the dividerline to say Color.Red, how would I do that? I don't want to change the background color of the cell.

+2


source to share


2 answers


DataGridView.GridColor It looks like it also controls the row separator color.



+5


source


On the MSDN page for DataGridView.DividerHeight

This property is useful for the visual border between frozen and scrollable lines. The extra edge is part of the current row, although it will take on the foreground color of the corresponding DataGridView.



So it looks like you cannot set the color directly, but setting the foreground color of the DataGridView will change it.

+3


source







All Articles