views:

407

answers:

2

Hi

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

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

A: 

From the MSDN page for DataGridView.DividerHeight

This property is useful to provide a visual boundary between frozen rows and rows that can scroll. The extra edge is part of the current row, although it will take on the foreground color of the associated DataGridView.

So it looks like you can't set the colour directly, but setting the foreground colour of the DataGridView will change it.

ChrisF
Hmm, that sound correct, but after testing I cant make it work. The divider color dont change.
Martin S
Sorry - I haven't used this myself, I just double checked the MSDN page. Is there anything else linked from that page that might help?
ChrisF
A: 

DataGridView.GridColor Looks like it controls the row divider color as well.

OG