Put bitmap to StringGrid

Posted in Components

Use StrechDraw property of the StringGrid.Canvas and don't forget to free the bitmap.

procedure TForm1.Button1Click(Sender: TObject);
var
  Bitmap: TBitmap;
begin
  Bitmap:=TBitmap.Create;
  Bitmap.LoadFromFile('factory.bmp');
  StringGrid1.Canvas.StretchDraw(StringGrid1.CellRect(1,1),Bitmap);
  Bitmap.Free;
end;