You can use the CurrentCellChanged event and change the background color of the current cell; however, if you are using a Vista style, you will need to also override the UIStyle for this to works, since when choosing a style like AERO, it automatically sets many properties.
private void Form1_Load( object sender, EventArgs e ) { gridControl1.CurrentCellChanged += new EventHandler( gridControl1_CurrentCellChanged );
//For a Vista theme gridControl1.SelectionVisualStyle.OverrideUIStyle = true; gridControl1.SelectionVisualStyle.BackColor = Color.FromArgb( 40, gridControl1.SelectionBackColor ); }
private DataCell previousCell;
void gridControl1_CurrentCellChanged( object sender, EventArgs e ) { if( previousCell != null ) { previousCell.BackColor = gridControl1.DataRowTemplate.BackColor; } if( gridControl1.CurrentCell.GetType() == typeof( DataCell ) ) { gridControl1.CurrentCell.BackColor = Color.DeepPink; } previousCell = gridControl1.CurrentCell as DataCell; } |