الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

تلوين الحقول في DbGrid

مغلق
بدأه ابواحمد في 25 فبراير 2003 · 3 رد · 985 مشاهدة · في لغة Delphi
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

الاخوة الكرام استخدمت هذا الكود في تلوين حقل في 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 من خلال محرر الحقول الخاصه بها فان الكود السابق لايعمل .

فما الحل جزاكم الله خير

#2

أرجو اجابت الأخ ابواحمد

وشــكرا له على هذا الكود (f)(f)(f)(gift)

#3

:'((clock)

#4

أرجو اجابت الأخ ابواحمد

:'(:'(:'( :'(:'(:'(:'( :'(:'(:'(:'(:'( :'(:'(:'(:'(

هذا الموضوع مغلق.

مواضيع مشابهة