Hallo,
versuche aus einer Imagelist ein Bitmap zu laden.
Delphi-Quellcode:
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
i : Integer;
Wert: string;
bmpImage: tBitmap;
intX, intY: Integer;
begin
if (DBGrid1.DataSource.DataSet.RecordCount = 0) then
Exit;
if column.FieldName = 'ICON' then
with DBGrid1.Canvas do
begin
fillRect(rect);
bmpImage := tBitmap.Create;
try
Wert := DBGrid1.DataSource.DataSet.FieldByName('GRID').Value;
if Wert = '0' then begin
DBGrid1.Canvas.Brush.Color := clwhite;
DBGrid1.Canvas.Font.Color := clHighlight;
end else
if Wert = '1' then begin
//DBGrid1.Canvas.Brush.Color := clred;
//DBGrid1.Canvas.Font.Color := clyellow;
ImageList1.Draw(DBGrid1.Canvas,Rect.Left+(Column.Width-17),Rect.Top+1,0); // Was ist hier falsch?
end else