Thema: Delphi Grafik in DBGrid

Einzelnen Beitrag anzeigen

bwolf

Registriert seit: 17. Jan 2006
368 Beiträge
 
Delphi 2009 Professional
 
#1

Grafik in DBGrid

  Alt 20. Mai 2009, 10:14
Hi Leute,

ich möchte in einem DBGrid in einer Zelle statt des Textes eine Grafik anzeigen.
Mit diesem Code von delphi.about.com wird schonmal eine Grafik zusätzlich vor dem Text angezeigt:

Delphi-Quellcode:
  // dbgridDrawColumnCell
  if (Column.Field.FieldName = 'name') then
  begin
    bitmap := TBitmap.Create;
    try
      //grab the image from the ImageList
      ImageList1.GetBitmap(0,bitmap);
      //Fix the bitmap dimensions
      bmpWidth := (Rect.Bottom - Rect.Top);
      fixRect.Right := Rect.Left + bmpWidth;
      //draw the bitmap
      dbgrid.Canvas.StretchDraw(fixRect,bitmap);
    finally
      bitmap.Free;
    end;
      // reset the output rectangle,
      fixRect := Rect;
      // add space for the graphics
      fixRect.Left := fixRect.Left + bmpWidth;
  end;
Ich probiere nun seit geraumer Zeit den Text zu entfernen, schaffs aber nicht so wirklich.
Kann mir da einer auf die Sprünge helfen?

Danke euch!
  Mit Zitat antworten Zitat