Home Forums WinForms controls Xceed Grid for WinForms Inverting the cursor appearance

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #15197 |

    Hello,

    is it possible to “invert” the cursor appearance in the grid?

    Now: the current row is blue, and the current cell is white with a dotted line around.

    What I wish for: the current line is white with a dotted line, and the current cell is blue.

    Any possibility?

    Imported from legacy forums. Posted by Kalle (had 1798 views)

    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)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.