Home Forums WinForms controls Xceed Grid for WinForms Inverting the cursor appearance Reply To: Inverting the cursor appearance

User (Old forums)
Member
Post count: 23064

I take it that you mean “invert” the color, and not the cursor.

You can change the SelectionBackColor and SelectionForeColor to change the row color. As for the CurrentCell color, you will need to do something like the following :
<code>
private void Form1_Load(object sender, System.EventArgs e)
{
gridControl1.CurrentCellChanged += new EventHandler(gridControl1_CurrentCellChanged);
}

private Cell previousCell;

private void gridControl1_CurrentCellChanged(object sender, EventArgs e)
{
if ( previousCell != null )
{
previousCell.BackColor = gridControl1.BackColor;
previousCell.ForeColor = gridControl1.ForeColor;
}
if( gridControl1.CurrentCell != null )
{
//in your case, you will need to specify the color, since the SelectionBackColor is not what you want
( ( Cell )gridControl1.CurrentCell).BackColor = gridControl1.SelectionBackColor;
( ( Cell )gridControl1.CurrentCell).ForeColor = gridControl1.SelectionForeColor;
previousCell = gridControl1.CurrentCell;
}
}
</code>.

As for the dotted line, the only way to have it on the whole row instead of just the current cell would be to set the AllowCellNavigation to false. However, you will not be able to move around each cell, which may not be what you want.

Imported from legacy forums. Posted by André (had 2926 views)