unit Unit1;
interface
uses
procedure TForm1.Button1Click(Sender: TObject);
var jpg : TJPEGImage;
bmp : TBitmap;
rect : TRect;
begin
// load the JPG
jpg := TJPEGImage.Create;
jpg.LoadFromFile('
D:\Work\grepsearch.JPG');
// assign in Bitmap
bmp := TBItmap.Create;
bmp.Assign(jpg);
// draw in the DrawGrid;
rect := DrawGrid1.CellRect(0, 0);
DrawGrid1.Canvas.StretchDraw(rect, bmp);
end;
procedure TForm1.DrawGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var jpg : TJPEGImage;
bmp : TBitmap;
rectt : TRect;
begin
// load the JPG
jpg := TJPEGImage.Create;
jpg.LoadFromFile('
D:\Work\grepsearch.JPG');
// assign in Bitmap
bmp := TBItmap.Create;
bmp.Assign(jpg);
// draw in the DrawGrid;
rectt := DrawGrid1.CellRect(0, 0);
DrawGrid1.Canvas.StretchDraw(rectt, bmp);
end;
procedure TForm1.DrawGrid1SelectCell(Sender: TObject; ACol, ARow: Integer;
var CanSelect: Boolean);
var
rect : TRect;
begin
rect := DrawGrid1.CellRect(ACol, ARow);
Image1.Canvas.CopyRect(rect, DrawGrid1.Canvas, rect);
end;
end.