color of row divider in datagridview

2019-07-16 08:21发布

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.

2条回答
Root(大扎)
2楼-- · 2019-07-16 09:14

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.

查看更多
可以哭但决不认输i
3楼-- · 2019-07-16 09:16

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

查看更多
登录 后发表回答