Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Changing Datagrid RowSelect Colours

zicheziche Member Posts: 47
Is it possible to change the Rowselect colouring of a standard DataGrid?

I'v seen the default colours of a Grid is a white backgound with black text.

A Rowselection inverts a row or cell to a dark blue background with white text.

I'v changed a few rows in my datagrid using the DrawColumnCell() event like this...

DBGrid1.Canvas.Brush.Color := clSilver;
DBGrid1.Canvas.Font.Color := clBlack;
DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);

now while the rest of the rows' colours are inverted as usual when they are selected, when those modified rows are selected, they are not inverted.

Any way of inverting these rows' colours as they are selected, then restoring them when selection moves away from them?

Comments

  • zibadianzibadian Member Posts: 6,349
    : Is it possible to change the Rowselect colouring of a standard DataGrid?
    :
    : I'v seen the default colours of a Grid is a white backgound with black text.
    :
    : A Rowselection inverts a row or cell to a dark blue background with white text.
    :
    : I'v changed a few rows in my datagrid using the DrawColumnCell() event like this...
    :
    : DBGrid1.Canvas.Brush.Color := clSilver;
    : DBGrid1.Canvas.Font.Color := clBlack;
    : DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
    :
    : now while the rest of the rows' colours are inverted as usual when they are selected, when those modified rows are selected, they are not inverted.
    :
    : Any way of inverting these rows' colours as they are selected, then restoring them when selection moves away from them?
    :
    :
    That is quite simple to do. Let the color-selection depend on the state of the cell. If it doesn't include anything, it is unselected.
Sign In or Register to comment.