abraXus
  • abraXus
  • Advanced Member Topic Starter
2023-06-28T19:26:35Z
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
Igor/10Tec
2023-06-29T16:26:56Z
There is no simple iGrid setting to implement this specific behavior. Why do you need this effect? Perhaps, you are not satisfied with the look of OS-styled checkboxes in selected cells because both are drawn with almost same blue colors, and the checkboxes are barely legible in selected cells. In this case you can use another selection color or semi-transparent selection.

As for me, the cell selection behavior (look) must be consistent for all cells, so that using the same selection color is a way to go - though this selection color will differ from the default one.