procedure TForm1.DrawGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
Bitmap : TBitMap;
begin
Bitmap := TBitmap.Create;
try
Bitmap.LoadFromFile('C:/WINDOWS/Circles.bmp');
Bitmap.Transparent := True;
Bitmap.TransParentColor := TDrawGrid(Sender).Color;
if (ARow=2) and (ACol=3) then // 画在第三行第四列
begin
with TDrawGrid(Sender).Canvas do
begin
Brush.Color := clWhite;
FillRect(Rect);
CopyRect(Rect,Bitmap.Canvas,Bitmap.Canvas.ClipRect );
//如果图象大小和删格不一样图象会变形,如果将上面的“Bitmap.Canvas.ClipRect”替换成其他TRect可以取原图象的部分
end;
end
finally
Bitmap.Free;
end;
end;