请参考如下代码<br>procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;<br> DataCol: Integer; Column: TColumn; State: TGridDrawState);<br>var<br> Bmp: TBitmap;<br> OutRect: TRect;<br> BmpWidth: Integer;<br>begin<br> // default output rectangle<br> OutRect := Rect;<br><br> if Column.Field = Table1Common_Name then<br> begin<br> // draw the image<br> Bmp := TBitmap.Create;<br> try<br> Bmp.Assign (Table1Graphic);<br> BmpWidth := (Rect.Bottom - Rect.Top) * 2;<br> OutRect.Right := Rect.Left + BmpWidth;<br> DBGrid1.Canvas.StretchDraw (OutRect, Bmp);<br> finally<br> Bmp.Free;<br> end;<br> // reset output rectangle, leaving space for the graphic<br> OutRect := Rect;<br> OutRect.Left := OutRect.Left + BmpWidth;<br> end;<br><br> // red font color if length > 100<br> if (Column.Field = Table1Lengthcm) and<br> (Table1Lengthcm.AsInteger > 100) then<br> DBGrid1.Canvas.Font.Color := clRed;<br><br> // default drawing<br> DBGrid1.DefaultDrawDataCell (OutRect, Column.Field, State);<br>end;