Click here to Skip to main content
15,936,349 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have two different projects both use DGV controls. In one I set at design time in the dgv properties RowHeaderDefaultCellStyle.SelectionBackColor = Color.Yellow. At run time the Row header (column -1)is yellow as it is suppose to be. In my second project I set at design time in the dgv properties the same RowHeaderDefaultCellStyle.SelectionBackColor = Color.Yellow but the color does not display as yellow. My guess is some other default cellstyle is overrideing my selected property. If my guess is right, what is overriding my color selection?
Posted
Comments
Sergey Alexandrovich Kryukov 8-Jun-15 22:11pm    
Not clear. The term "override" is only applicable to virtual methods, including property getters or setters.
—SA
Ralf Meier 9-Jun-15 0:30am    
@Sergey:
In some languages has "Overrides" the same Meaning as "Assign".

@Thread-Starter:
What value has the Property "EnableHeadersVisualStyles" ...?

1 solution

Solution found. The clue was the property "EnableHeadersVisualStyles". If this is set to False in the Form load Sub, in my case "dgv2.EnableHeadersVisualStyles = False" everything works as it should, i.e., I am able the change the color of the Column - 1 to yellow or whatever color I want. Note however, that setting it to False in the DGV properties table does not work, it must be in code, read at Run Time.
 
Share this answer
 

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