Ou par exemple un bazar du genre :
procedure TCalendrier.StGridPersoDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
var s:string;
begin
with StGridPerso do begin
if ((ARow mod 2)<>1) then
begin
canvas.brush.color:=CouleurImpair;
canvas.FillRect(rect);
end
else
begin
canvas.brush.color:=Couleurpair;
canvas.FillRect(rect);
end;
if (gdFixed in state) then begin
if ( ARow=0) and (ACol in [0..1]) then
begin
canvas.brush.color:=CouleurFix;
canvas.FillRect(rect);
canvas.font.style:=[fsbold];
s:=cells[Acol,0];
DrawText(Canvas.Handle,PChar(s),StrLen(PChar(s)),Rect,DT_CENTER);
end
else if ( ARow=0) and (ACol =2) then
begin
canvas.brush.color:=CouleurFixIntitule;
canvas.FillRect(rect);
canvas.font.style:=[fsbold];
s:=cells[Acol,0];
DrawText(Canvas.Handle,PChar(s),StrLen(PChar(s)),Rect,DT_CENTER);
end;
end;
if (ACol in [0..1]) and (ARow>0) then
begin
s:=uppercase(cells[ACol,ARow]);
DrawText(Canvas.Handle,PChar(s),StrLen(PChar(s)),Rect,DT_CENTER);
end;
if (ACol =2) and (ARow>0) then
begin
canvas.font.color:=clblack;
canvas.FillRect(rect);
canvas.textout(rect.left,rect.top,cells[ACol,ARow]);
end;
if (gdSelected in state) and (Arow >0) then
begin
canvas.brush.color:=CouleurSel;
canvas.FillRect(rect);
canvas.font.color:=clmaroon;
canvas.textout(rect.left,rect.top,cells[ACol,ARow]);
end;
if (gdSelected in state) and (Arow >0) and (Acol in [0..1]) then
begin
canvas.brush.color:=CouleurSel;
canvas.FillRect(rect);
canvas.font.color:=clmaroon;
canvas.font.style:=[fsbold];
s:=cells[Acol,ARow];
DrawText(Canvas.Handle,PChar(s),StrLen(PChar(s)),Rect,DT_CENTER);
end;
end;
end;
Message édité par kiki29 le 28-04-2006 à 07:17:26