在DBGrid的DrawDataCell事件中: with (sender as TDBGrid).Canvas do begin if Table1.Fieldbyname(′Salary′).value<=SpinEdit1.value then DBGrid1.Canvas.Brush.Color:=ColorGrid1.ForeGroundColor else DBGrid1.Canvas.Brush.Color:=ColorGrid1.BackGroundColor; DBGrid1.Canvas.FillRect(Rect); DBGrid1.Canvas.TextOut(Rect.left+2,Rect.top+2,Field.AsString);end;
with (sender as TDBGrid).Canvas do
begin if Table1.Fieldbyname(′Salary′).value<=SpinEdit1.value then DBGrid1.Canvas.Brush.Color:=ColorGrid1.ForeGroundColor else DBGrid1.Canvas.Brush.Color:=ColorGrid1.BackGroundColor; DBGrid1.Canvas.FillRect(Rect); DBGrid1.Canvas.TextOut(Rect.left+2,Rect.top+2,Field.AsString);end;
DBGrid1.Canvas.Brush.Color
改成
DBGrid1.Canvas.Font.Color