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
| procedure DrawGRID(Valeur :TEdit;NomChps : String ;Const MyGrid:TDBGrid;Const State:TGridDrawState;
Const Rect: TRect; DataCol: Integer; Column: TColumn);
begin
with MyGrid do
begin
if gdSelected in State then
begin
Canvas.Brush.Color := Couleur_De_Selection
end
else
begin
if (Uppercase(DataSource.DataSet[NomChps].asString)=Uppercase(Valeur.Text)) then
Canvas.Brush.Color := Couleur_2
else
Canvas.Brush.Color := Couleur_1
end;
DefaultDrawColumnCell(rect,datacol,column,state);
end
end;
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
DrawGRID(edit1,DBGrid1,'nom',State,Rect,DataCol,Column);
end; |