//改变Title的颜色 procedure TFormMain.DBGridEh1DrawTitleCell(Sender: TObject; Canvas: TCanvas; Field: TField; Rect: TRect; var DefaultDrawing: Boolean); begin if Field.FieldName = 'a' then begin (Sender as TwwDBGrid).Canvas.Brush.Color:= clYellow; (Sender as TwwDBGrid).Canvas.FillRect(Rect); end else begin (Sender as TwwDBGrid).Canvas.Brush.Color:= clBtnFace; (Sender as TwwDBGrid).Canvas.FillRect(Rect); end; end; //改变Column的颜色 procedure TFrmDescription.wwDBGridDescriptionCalcCellColors( Sender: TObject; Field: TField; State: TGridDrawState; Highlight: Boolean; AFont: TFont; ABrush: TBrush); begin inherited; if (Field.FieldName = 'aa') and not (gdSelected in TGridDrawState(State)) then ABrush.Color:= clInfoBk; end;
procedure TFormMain.DBGridEh1DrawTitleCell(Sender: TObject;
Canvas: TCanvas; Field: TField; Rect: TRect;
var DefaultDrawing: Boolean);
begin
if Field.FieldName = 'a' then begin
(Sender as TwwDBGrid).Canvas.Brush.Color:= clYellow;
(Sender as TwwDBGrid).Canvas.FillRect(Rect);
end else begin
(Sender as TwwDBGrid).Canvas.Brush.Color:= clBtnFace;
(Sender as TwwDBGrid).Canvas.FillRect(Rect);
end;
end;
//改变Column的颜色
procedure TFrmDescription.wwDBGridDescriptionCalcCellColors(
Sender: TObject; Field: TField; State: TGridDrawState;
Highlight: Boolean; AFont: TFont; ABrush: TBrush);
begin
inherited;
if (Field.FieldName = 'aa') and not (gdSelected in TGridDrawState(State)) then
ABrush.Color:= clInfoBk;
end;