WinForms: color DataGridView border

winforms

How can I change the color of a DataGridView border when BorderStyle = FixedSingle?

Best Solution

You cannot change the border color, it is system defined.

Instead you could try turning off the border setting and then placing the DataGridView inside a Panel. Where the DataGridView is set to Dock.Fill and the Panel has a Padding of 1 pixel on all edges. Then setting the background color of the Panel will show as a border around the contained DataGridView.