我知道答案了,通过一个星期的搜索终于找到答案了! 现将代码展示如下: type TMyDBGrid=class(TDBGrid); ////////////////////////////////// //DBGrid1.Options->dgEditing=True //DBGrid1.Options->dgRowSelect=False procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin with TMyDBGrid(Sender) do begin if DataLink.ActiveRecord=Row-1 then begin Canvas.Font.Color:=clWhite; Canvas.Brush.Color:=$00800040; end else begin Canvas.Brush.Color:=Color; Canvas.Font.Color:=Font.Color; end; DefaultDrawColumnCell(Rect,DataCol,Column,State); end; end; 本段代码是我在:“乘风原创程序(http://www.qqcf.com)”处搜到的详细出处参考:http://study.qqcf.com/web/523/100400.htm
现将代码展示如下:
type
TMyDBGrid=class(TDBGrid);
//////////////////////////////////
//DBGrid1.Options->dgEditing=True
//DBGrid1.Options->dgRowSelect=False
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
with TMyDBGrid(Sender) do
begin
if DataLink.ActiveRecord=Row-1 then
begin
Canvas.Font.Color:=clWhite;
Canvas.Brush.Color:=$00800040;
end
else
begin
Canvas.Brush.Color:=Color;
Canvas.Font.Color:=Font.Color;
end;
DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
end; 本段代码是我在:“乘风原创程序(http://www.qqcf.com)”处搜到的详细出处参考:http://study.qqcf.com/web/523/100400.htm