又增加一个Image2
(为了使程序体积小,可以动态生成两个图象控件)
(插播一段小广告^_^ WIN***破解王 http://keepboom.my.freedim.net)
procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
begin
if (Field.FieldName = 'Bill_Code') then
begin
if (gdSelected in State) then
DBGrid1.Canvas.Draw(Rect.Left,Rect.Top,Image1.Picture.Graphic)
else
DBGrid1.Canvas.Draw(Rect.Left,Rect.Top,Image2.Picture.Graphic);
end;
end;