Delphi Tips&Tricks News   Tips   .NET Software   VCL Software   Search   Contacts
Special Offer!

Ultimate Pack  hot!
Image Editor  new!
Runtime Fusion
Form Designer
Object Inspector
Print Suite Pro
Commented Image
Delphi Toys
WinDowse
Delphi Bonus
TMS Scripter Studio
Form Designer VB
Form Designer .NET

...get more...
for Delphi.NET, C#, VB.NET
for Delphi VCL, BCB 3-6

WinAPI Online
Unix Manual Pages
MegaDetailed.NET
in3steps.com

Blogspot  greatis.blogspot.com

 See more ads about delphi programming →


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


 See more ads about delphi components →