tstringgrid via ondrawcell
Bonjour à tous, je essai de colorier certaines case mais voila je n arrive pas à colorier celles que je voudrai.En fite j ai les jours et l heure come echelle et je voudrai mettre les samedi et dimanche d une autre couleur ainsi que toute la ligne qui leurs corespond.
source:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
begin
with (Sender as TStringGrid) do
begin
if (ACol = 0) or (ARow = 0) then
Canvas.Brush.Color := clBtnFace;
if stringgrid1.Cells[acol,arow] ='Dimanche' then
begin
canvas.Brush.Color:=clblue ;
ligne:=arow; end
else if stringgrid1.Cells[acol,arow] ='Samedi' then canvas.Brush.Color:=clblue
else
Canvas.Brush.Color :=clgreen;
Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top + 2, cells[acol, arow]);
Canvas.FrameRect(Rect);
end;
end; |
[/code]