How to set the current cell backcolor to the backcolor of remaining selected cells in WinForms GridControl?
Backcolor settings
When the current cell is not in edit mode, it is generally a part of the selection. When you want to set the BackColor like the other selected cells, then you have to use the CellDrawn event
void gridControl1_CellDrawn(object sender, Syncfusion.Windows.Forms.Grid.GridDrawCellEventArgs e)
{
//get the currentcell
GridCurrentCell cc = this.gridControl1.CurrentCell;
if (e.RowIndex == cc.RowIndex && e.ColIndex == cc.ColIndex)
{
//fill the selection color to the cells background
using (SolidBrush br = new SolidBrush(this.gridControl1.AlphaBlendSelectionColor))
{
e.Graphics.FillRectangle(br, e.Bounds);
}
}
}Private Sub gridControl1_CellDrawn(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridDrawCellEventArgs)
'get the currentcell
Dim cc As GridCurrentCell = Me.gridControl1.CurrentCell
If e.RowIndex = cc.RowIndex AndAlso e.ColIndex = cc.ColIndex Then
'fill the selection color to the cells background
Using br As New SolidBrush(Me.gridControl1.AlphaBlendSelectionColor)
e.Graphics.FillRectangle(br, e.Bounds)
End Using
End If
End SubAfter applying the properties, the Grid is
shown as follows,

Figure 1: The BackColor of the selected cell is set to the BackColor of the current cell
Samples: