不需要用第三方控件吧?不是有个FixedColor属性吗?另外在DBGrid的OnDrawColumnCell里面加代码就可以了,如下:procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin with TDBGrid(Sender) do begin case Self.ADOQuery1.RecNo Mod 2 of 0: Canvas.Brush.Color :=clMoneyGreen; 1: Canvas.Brush.Color :=clWindow; end; if gdSelected in State then //这个是改变被选择行的高亮颜色 begin Canvas.Font.Color :=clBackground; Canvas.Brush.Color:=clSkyBlue; Canvas.FillRect(Rect); end; DefaultDrawColumnCell(Rect,DataCol,Column,State); end; end;
不需要用第三方控件吧?不是有个FixedColor属性吗?另外在DBGrid的OnDrawColumnCell里面加代码就可以了,如下:procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin with TDBGrid(Sender) do begin case Self.ADOQuery1.RecNo Mod 2 of 0: Canvas.Brush.Color :=clMoneyGreen; 1: Canvas.Brush.Color :=clWindow; end; if gdSelected in State then //这个是改变被选择行的高亮颜色 begin Canvas.Font.Color :=clBackground; Canvas.Brush.Color:=clSkyBlue; Canvas.FillRect(Rect); end; DefaultDrawColumnCell(Rect,DataCol,Column,State); end; end;
begin
dbgrid1.Color :=clred;
end;
哪里有cxDBGrid控件啊!,能否给发一个 [email protected]
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
with TDBGrid(Sender) do
begin
case Self.ADOQuery1.RecNo Mod 2 of
0: Canvas.Brush.Color :=clMoneyGreen;
1: Canvas.Brush.Color :=clWindow;
end;
if gdSelected in State then //这个是改变被选择行的高亮颜色
begin
Canvas.Font.Color :=clBackground;
Canvas.Brush.Color:=clSkyBlue;
Canvas.FillRect(Rect);
end;
DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
end;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
with TDBGrid(Sender) do
begin
case Self.ADOQuery1.RecNo Mod 2 of
0: Canvas.Brush.Color :=clMoneyGreen;
1: Canvas.Brush.Color :=clWindow;
end;
if gdSelected in State then //这个是改变被选择行的高亮颜色
begin
Canvas.Font.Color :=clBackground;
Canvas.Brush.Color:=clSkyBlue;
Canvas.FillRect(Rect);
end;
DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
end;
up