How in Delphi dxDBGrid can I change the color of one row?

Basically the client wants to change the color of one row in Delphi dxDBGrid. No row property like columns.

Any ideas?

+1


source to share


3 answers


Sorry, just use the OnCustomDraw event. Friday morning.



+2


source


You can use styles. The DevExpres grid in DBTableView has an event named: OnGetContentStyle in the Styles section.

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

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

      

With ARecord, you can access the actual values ​​of a record. With these values, you define and change the value of the AStyle (out) parameter. This line is colored with this style.



Hey.


Neftali
Germán Estévez

+3


source


I am using the grid event OnCustomDrawCell like:

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

      

It is assumed to be the QuantumGrid v3 you are talking about. If it's v4 or later, then the answer pointing you to cxStyles is correct.

+2


source







All Articles