Hi all,
I am trying to change the color of the columns of an stringgrid by using a toolbutton to colorize or not that cells. I made it writing this code:
if (ARow > 0) then
begin
if aCol < 1 then FilesGrid.Canvas.Brush.Color := clWhite
else if aCol <6 then FilesGrid.Canvas.Brush.Color := clMoneyGreen
else if aCol <8 then FilesGrid.Canvas.Brush.Color := clWhite
else if aCol < 17 then FilesGrid.Canvas.Brush.Color := $00E1FFF9 //Pale yellow
else if aCol < 26 then FilesGrid.Canvas.Brush.Color := $00FFEBDF //Pale blue
else if aCol < 29 then FilesGrid.Canvas.Brush.Color := $00D3FFE4 //Pale green
else if aCol < 33 then FilesGrid.Canvas.Brush.Color := $00FFE5FC; //Pale pink
FilesGrid.Canvas.FillRect(aRect);
FilesGrid.Canvas.Font.Color := clBlack;
FilesGrid.canvas.textrect(aRect, aRect.Left + 4, aRect.Top, FilesGrid.cells[acol,arow])
end;
Although it works nice, the problem is that many of those columns contains a checkbox. Then, when the button is used to colorize the cell, the checkbox dissapear to show 1 or 0. When the stringgrid is in edit mode, i am able to change from 1 to 0 or viceversa by clicking in the cell. So, it works, but it does not show the checkbox.
Then, my questions are if this is a bug or if i must complete my code to say to lazarus to paint again the checkboxes and how to do it.
Thanks so much!