Board index » delphi » Reading the color of a cell in dbgrid

Reading the color of a cell in dbgrid

Hello,

I have a dbgrid filled with different colors for different cells. When I
enter a cell I want to read the color of  that cell again. We don't seem to
get this done.
We tried
  DbGrid1.Canvas.Brush.Color
But then I get the backgroundcolor of the grid and not the cell.
Any ideas?

Thanks in advance,

Stijn Vanderfeesten

VZW Stijn
Breugelweg 200
3900 Overpelt
+32/11/805.838
Stij...@Stijn.be
www.Stijn.be

 

Re:Reading the color of a cell in dbgrid


type TMyCustomGrid = class(TCustomGrid);

var rect:TRect;
    Clr:TColor;

 rect := TMyCustomGrid(DBGrid1).CellRect(1,1);

Clr:=DBGrid1.Canvas.Pixels[round((rect.Left+rect.Right)/2),round((rect.Top+r
ect.Bottom)/2)];

Quote
"Stijn Vanderfeesten" <Stij...@Stijn.Be> wrote in message

news:3e40c584$0$14684$ba620e4c@news.skynet.be...
Quote
> Hello,

> I have a dbgrid filled with different colors for different cells. When I
> enter a cell I want to read the color of  that cell again. We don't seem
to
> get this done.
> We tried
>   DbGrid1.Canvas.Brush.Color
> But then I get the backgroundcolor of the grid and not the cell.
> Any ideas?

> Thanks in advance,

> Stijn Vanderfeesten

> VZW Stijn
> Breugelweg 200
> 3900 Overpelt
> +32/11/805.838
> Stij...@Stijn.be
> www.Stijn.be

Other Threads