ورود

View Full Version : تغییر رنگ سطرهای انتخابی در DBGrid



DataMaster
دوشنبه 14 آذر 1384, 08:39 صبح
سلام
من می خوام یه جستجو توی table کنم و بعد از اون رکوردهایی رو که دارای شرط جستجو هستند در DBGrid با رنگ دیگه ای نمایش داده بشه
مرسی

Developer Programmer
دوشنبه 14 آذر 1384, 15:16 عصر
اگه جستجو می کردین ، دقیقا یک میلیاد تاپیک مشابه پیدا میکردید که در آنها یک میلیون بار پاسخ داده شده که قبلا مطرح شده!

ehsan2000
دوشنبه 14 آذر 1384, 15:27 عصر
procedure Twork1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin

if workKind.Value =4 then
begin
DBGrid1.Canvas.Brush.Color :=$00C2FED0;
end;

if gdSelected in state then
begin
DBGrid1.Canvas.Brush.Color :=clred ;
DBGrid1.Canvas.Font.Color :=clBlue ;
end;

if gdFocused in state then
begin
DBGrid1.Canvas.Brush.Color :=clred ;
DBGrid1.Canvas.Font.Color :=clBlue ;
end;

DBGrid1.DefaultDrawColumnCell(Rect,datacol,Column ,State );
end;