Vielen Dank! Jetzt klappt es !!!


Code: Alles auswählen
OnDrawColumnCell
If Not Column.Field.DataSet.IsEmpty And Assigned(lstRating) Then
Begin
TDbGrid(Sender).Canvas.Brush.Color := clWindow;
if gdRowHighlight in State then
TDbGrid(Sender).Canvas.Brush.Color :=
ColorToRGB(TDbGrid(Sender).Canvas.Brush.Color) xor $1F1F1F;
SetGridDrawColorSort(Sender, Column, State);
TDBGrid(Sender).Canvas.FillRect(Rect);
rct := Rect;
If Not Column.Field.IsNull Then
Begin
i := (lstRating.Count Div 2) + Column.Field.AsInteger - 1; // Umrechnung +/- auf Listenindex
bm := TBitmap(lstRating[i]);
if rct.Right - rct.Left > bm.Width Then
rct.Right := rct.Left + bm.Width;
If rct.Bottom - rct.Top > bm.Height Then // Feld ist höher als das Bitmap, Mittig zeichnen
Begin
rct.Top := (((rct.Bottom - rct.Top) Div 2) + rct.Top) - (bm.Height Div 2);
rct.Bottom := rct.Top + bm.Height;
end;
TDbGrid(Sender).Canvas.StretchDraw(rct, bm)
End;
End;
End;