ورود

View Full Version : تعیین رنگ سطرهای DBGird



hr_110
دوشنبه 02 آذر 1383, 00:16 صبح
چطوری میشه رنگ بعضی از سطرهای DBGrid رو عوض کرد؟

vcldeveloper
دوشنبه 02 آذر 1383, 04:23 صبح
باید در رویداد OnDrawColumnCell کدی شبیه به این بنوسید:


procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if {some conditions} then
DBGrid1.Canvas.Brush.Color := clRed; //or any other colors

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