//设置 网格 颜色
procedure SetDBGridBrushColor(var Ser:TObject;const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState;iiEdit:integer);
begin
case iiEdit of
1:begin
if (TDBGrid(Ser).DataSource.DataSet.RecNo mod 2=0) then
begin
TDBGrid(Ser).Canvas.Font.Color :=clBlack;
TDBGrid(Ser).Canvas.Brush.color:=clInfoBk;
end;
end;
2:begin
if (DataCol mod 2=0) then
begin
TDBGrid(Ser).Canvas.Font.Color :=clBlack;
TDBGrid(Ser).Canvas.Brush.color:=clInfoBk;
end;
end;
end;
if ((State = [gdSelected]) or (State = [gdFocused,gdSelected])) then
if not TDBGrid(Ser).SelectedRows.CurrentRowSelected then
begin
TDBGrid(Ser).Canvas.Font.Color :=clWindow;
TDBGrid(Ser).Canvas.Brush.Color:=clHighlight; //当前选中单元格显示红色
end;