views:

905

answers:

3

Basically a client wants to change the color of a single row in a Delphi dxDBGrid. There isn't a rows property like there is columns.

Any ideas?

+2  A: 

Sorry, simply use the OnCustomDraw event. argh Friday mornings.

Dano
+2  A: 

You can use styles. The DevExpres Grid in DBTableView has a event named: OnGetContentStyle in Styles part.

You can create at design two styles and apply the desired style at runtime.

procedure TFormBrBase.DBTableViewStylesGetContentStyle(
  Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
  AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);

With ARecord you can access to the actual record values. With this values you decide and change the value of the AStyle(out) param. This line is painted with this style.

Greetings.


Neftalí
Germán Estévez

Neftalí
Picky point but I think he was referring to the previous version of the Quantum Grid - the dxDBGrid - not the cxGrid.
RichardS
+1  A: 

I use on the grid's OnCustomDrawCell event, eg:

If ANode.Values[SomeColumnName.Index] = SomeValue then
  AFont.Color := clRed;

This is assuming it is the QuantumGrid v3 you're referring to. If it's v4 or later then the answer pointing you at cxStyles is correct.

RichardS