الاخوة الكرام استخدمت هذا الكود في تلوين حقل في DbGrid
procedure TFqard.DBGrid3DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
const
clPaleGreen = TColor($CCFFCC);
clPaleRed = TColor($CCCCFF);
begin
DBGrid3.Canvas.Font.Color := clBlack; {Set default font color}
if (gdFocused in State) then begin {Is current cell the focused cell?}
DBGrid3.Canvas.Brush.Color := clBlack;
DBGrid3.Canvas.Font.Color := clWhite;
end else if (Field.FieldName = 'Tsded') then {Not focused, is it the target field Terms?}
if (Field.AsString = 'مسدد') then {Check field content for one of two possible values}
DBGrid3.Canvas.Brush.Color := clPaleGreen
else DBGrid3.Canvas.Brush.Color := clPaleRed
else DBGrid3.Canvas.Brush.Color := clWhite; {Paint non-focused and non-target cells white}
DBGrid3.DefaultDrawDataCell(Rect, Field, State); {Draw the cell!}
end;ولكن واجهتني مشكلة وهي اذا تم اضافة الحقول الى DbGrid من خلال محرر الحقول الخاصه بها فان الكود السابق لايعمل .
فما الحل جزاكم الله خير