type
THackedGrid = class(TDBGrid);
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
R : TRect;
Pic : TPicture;
i : integer;
begin
with Sender as TDBGrid do
begin
//Draw the image on the third colum
if DataCol = 2 then
begin
Pic := TPicture.Create;
try
pic.Assign(Image1.Picture); //--> Create your own image!
R.TopLeft := Point(0,0);
R.Bottom := THackedGrid(DBGrid1).RowHeights[0];
//Calculate the picture's Left value
for i := 0 to DataCol-1 do
Inc(R.Left,Columns[i].Width);
//The picture must be drawn after the column's title
Inc(R.Left,Canvas.TextWidth(Column.Title.Caption) + 8);
R.Right := Pic.Width + R.Left;
//Draw the picture
Canvas.StretchDraw(R,Pic.Graphic);
finally
Pic.Free;
end;
end; //if DataCol
DefaultDrawColumnCell(Rect,DataCol,Column,State);
end; //With
end;