Dibujar imágenes en las celdas de un StringGrid

5770 vistas

Para ello nos vamos a servir del evento OnDrawCell teniendo previamente cargada la imagen en un TImage (por ejemplo)

Veamos cómo dibujar la imagen en la celda (3,2)



delphi
  1. procedure TForm1.StringGrid1DrawCell(Sender: TObject; Col, Row: Integer;
  2.   Rect: TRect; State: TGridDrawState);
  3. begin
  4.   if (Row = 3) and (Col = 2) then
  5.     with StringGrid1.Canvas do
  6.       Draw(Rect.Left, Rect.Top, Image1.Picture.Graphic);
  7. end;