Background on the grid style I am trying to use:
Single cell selection only, not using
RowMode.
My checkbox cells are sometimes just the checkbox graphic without any text in the cell with it, if that matters.
I am not using the column's
CellStyle in this case; each checkbox cell is set individually.
I would like my checkbox cells to not show the highlight/selection color when they are clicked, but for non-checkbox cells, I want their highlighting to act like normal.
The closest thing (
SelCellsBackColor/
SelCellsBackColorNoFocus ) affects the entire grid when it's changed, so I have to keep setting it back and forth based on the selected cell.
I came up with this code that seems to do just what I want, but I was hoping for a solution that involved something other than using an Event.
Are there any options I am missing? I've missed things before. Maybe there's another better way to do this that I have not thought of.
I didn't see anything in TypeFlags.
CurCellBackColor/
CurCellBackColorNoFocus seem to have the same restrictions.
If this is my only option, it's not the end of the world, but it would be nice to just set up some properties to get this behavior.
Private Sub IGrid1_CurCellChanged(sender As Object, e As iGCurCellChangedEventArgs) Handles IGrid1.CurCellChanged
' disable highlight for check cells
With DirectCast(sender, iGrid)
If .CurCell Is Nothing Then Return
If .CurCell.Type = iGCellType.Check Then
.SelCellsBackColor = Color.Transparent
.SelCellsBackColorNoFocus = Color.Transparent
Else
.SelCellsBackColor = SystemColors.Highlight
.SelCellsBackColorNoFocus = SystemColors.Highlight
End If
End With
End Sub
Edited by user
2023-06-28T19:27:31Z
|
Reason: Not specified