|
|
Create DBGrid that shows images - Databases - Tips & Tricks - Greatis Delphi Pages
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;
- Related chapters
-
Components
- Related topics
-
Create DBGrid with colored cells
Set colors for DBCtrlGrid's lines
Put bitmap to StringGrid
- For more
-
Delphi Help
- Download source
|