Board index » delphi » TDbCtrlGrid

TDbCtrlGrid

How can I get different colors for each panel in a TDbCtrlGrid depending the
value of a field in the represented field of its associated DataSet? Please,
ask me as soon as possible.

 

Re:TDbCtrlGrid


You need to use the OnPaintPanel event. I found that trying to set the
colour of a component on the panel didn't work, as it affected all of the
panels, so instead I ended up drawing a small coloured rectangle on the
panel to indicate some condition. This event is generated for each record in
the Table/Query.

DBCtrlGrid.Canvas.brush.color := clYellow;

if (Table['Field'])
then
   DBCtrlGrid.Canvas.brush.color := clRed;

DBCtrlGrid.Canvas.Rectangle(x1,y1,x2,y2);

Quote
Gerardo Cabezon wrote in message <6mgnc5$d...@forums.borland.com>...
>How can I get different colors for each panel in a TDbCtrlGrid depending
the
>value of a field in the represented field of its associated DataSet?
Please,
>ask me as soon as possible.

Other Threads