Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming! |
⤷ Create DBGrid that shows images
First of all set DefaultDrawing flag of the DBGrid to the False. Then add the following code to the DBGrid's OnDrawColumnCell event:
procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
var
Bmp: TBitmap;
begin
if Field is TGraphicField then
begin
try
Bmp:=TBitmap.Create;
Bmp.Assign(Field);
DBGrid1.Canvas.StretchDraw(Rect, Bmp);
finally
Bmp.Free;
end
end
else
DBGrid1.DefaultDrawDataCell(Rect, Field, State);
end;
-
More for developers