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 28 29 30 31 32
| procedure TForm1.MonCalDrawCell(Sender: TObject; aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState);
begin
With Sender As TStringGrid Do With Canvas Do
Begin
clear;
// Colonne de Gauche
if (acol = 0) and (arow>0) and (arow < moncal.rowCount-1) then
begin
Canvas.Brush.Color := clMoneyGreen;
Canvas.FillRect(arect);
Pen.Color:=clgreen;
Canvas.MoveTo(aRect.Right, aRect.Top);
Canvas.LineTo(aRect.left, aRect.Top);
Canvas.LineTo(aRect.left, aRect.Bottom);
Canvas.LineTo(aRect.Right, aRect.Bottom);
Cells[Acol,Arow] := Inttostr(Arow) ;
end;
// Colonne de Droite
if (acol = Moncal.ColCount-1) and (arow >0) and (arow < Moncal.rowCount-1) then
begin
Canvas.Brush.Color := clMoneyGreen;
Canvas.FillRect(arect);
Pen.Color:=clgreen;
Canvas.MoveTo(aRect.Right, aRect.Top);
Canvas.LineTo(aRect.left, aRect.Top);
Canvas.LineTo(aRect.left, aRect.Bottom);
Canvas.LineTo(aRect.Right, aRect.Bottom);
Cells[Acol,Arow] := Inttostr(Arow) ;
end;
DrawText(Canvas.Handle, PChar(Cells[ACol,ARow]), -1, aRect, DT_CENTER or DT_NOPREFIX or DT_VCENTER or DT_SINGLELINE );
End;
end; |
Partager