Home Forums WinForms controls Xceed Grid for WinForms Getting color value of row

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

    I have some data that is being searched, and as I find it, I set the backcolor. When I research, I want to verify the color of the row Im on, and if its the already searched color, I want to reset it to another color.

    So what I have is 3 colors. Default backcolor, currently searched color, already found color.

    I load the grid, start my search, if the item is found, I set the row backcolor to green. My second search goes thru, it finds the green background (different item searched) and I set the backcolor to blue.

    Hope that was clear.

    Imported from legacy forums. Posted by Christopher (had 4397 views)

    User (Old forums)
    Member
    Post count: 23064

    Your explanation is clear, your question is not! What is it that you want to know? You can do this using the row or cell BackColor property and ResetBackColor() method.

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

    User (Old forums)
    Member
    Post count: 23064

    I figured it was a bit cryptic.

    I need to know what the background color is for the current row.

    Imported from legacy forums. Posted by Christopher (had 349 views)

    User (Old forums)
    Member
    Post count: 23064

    Use gridControl1.CurrentRow.GetDisplayBackColor().Name;

    The GetDisplayBackColor() method is available on any GridElement, thus you can use it on DataRows[ index ] or SelectedRows[ index] too.

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

    User (Old forums)
    Member
    Post count: 23064

    Ok, now how do I compare it against a color? – This is the part Im having issues with.

    Imported from legacy forums. Posted by Christopher (had 327 views)

    User (Old forums)
    Member
    Post count: 23064

    Do something like this :

    if( gridControl1.CurrentRow.GetDisplayBackColor() == Color.Chocolate )
    {
    System.Diagnostics.Debug.WriteLine( “Same color” );
    }
    else
    {
    System.Diagnostics.Debug.WriteLine( “Different color” );
    }

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

    User (Old forums)
    Member
    Post count: 23064

    Ill try that, thanks.

    Imported from legacy forums. Posted by Christopher (had 5426 views)

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