Click here to Skip to main content
14,970,345 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can the color of the row header column of DataGridView (I believe it is column index -1) be changed in code or property settings to red or green or some other color? If so how?

[edit: added WinForm-Tag /manchanx]
Updated 15-Mar-15 15:22pm

1 solution

The solution is to add one line of code. (I added it to Sub Form1_Load.)
DataGridView1.EnableHeadersVisualStyles = False. With this added code the properties item RowHeadersDefaultCellStyle will respond to the selection of color in BackColor and SelectionBackColor which is what I was looking for. This in indeed the -1 column in DataGridView.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900