1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| TForm1.StringGrid1DrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
var x,y:integer; s:string;
begin
// pour colorier les colonnes
if (acol=0) and (arow>=1) then
with StringGrid1.Canvas do begin
if not (gdSelected in state) then begin
Pen.Style:=psClear;
Brush.Style:=bsSolid;
Brush.Color:=rgb(245,250,203);
Rectangle(Rect.Left,Rect.Top,Rect.Right,Rect.Bottom);
end;
s:=StringGrid1.Cells[acol,arow];
x:=2+Rect.Left;
y:=1+Rect.Top+(Rect.Bottom-Rect.Top-TextHeight(s))div 2;
Font.Style:=[fsBold];
TextOut(x,y,s);
Pen.Style:=psSolid;
end;
end; |
Partager