So I have a datagridview, it has cellformatting and depending on whether there is a value in the bindingsource, will put an image in the cell.
All good so far.
Now, the background selection colour (color for the Americans) has been changed so it uses a white or black text depending on the brightness of the custom colour that the user can assign to the DGV selected rows property value. For eg.
DGV.DefaultCellStyle.SelectionBackColor = Color.DarkGray
DGV.DefaultCellStyle.SelectionForeColor = Color.DarkGray
So for a dark blue DGV (only on the column headings and selected rows), the font pen is changed to White and if the DGV headings and selected rows is a Yellow, then the system has been set to use Black as as the font pen.
The issue is, the graphic is a black tick in a circle box and if the DGV has been set to use, say, a dark blue, the text is white but the graphic is Black - and can be difficult to see.
Rows can be selected/unselected by the user at will.
My cellformatting just checks to see if the bindingsource value is a 1 and then assigns the circle with a tick within, normally, unselected rows, colours are white (and must be)
I have a white version of the tick within a circle, but I cannot seem to assign the graphic to those rows that are either pre-selected or are selected during the cellformatting.
What I am looking for is to be able to detect (if possible within cellformatting) if a row that cellformatting is currently looking at (its index i.e. e.rowindex), has been selected so I can use the alternative graphic that is white-outlined, instead of the black outlined so its visibly clear.
Row selections are performed either on-the-fly or are selected during the load up of the form.
What I have tried:
I have tried (in the cellformatting) to see if the e.rowindex=DGV.selectedrows (but at that point I dont know what the index of the selectedrows would be.. or e.rowindex=DGV.currentrow - which fails if nothing has yet been selected.