delphi dbgrid行颜色改变

把 dgRowSelect 设为True, 在option里面.


// DBGrid1的OnDrawColumnCell事件


if ((State = [gdSelected]) or (State=[gdSelected,gdFocused])) then
    begin
      DBGrid1.Canvas.Font.Color :=ClYellow;
      DBGrid1.Canvas.Brush.Color :=clblue;  //关键
      DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
 end;
DBGrid1.Canvas.Font.Color :=ClYellow;//字体颜色,可以改成你想要的
DBGrid1.Canvas.Brush.Color :=clblue;  //背景颜色,可以改成你想要的

猜你喜欢

转载自blog.csdn.net/qin_yaping/article/details/77839180
今日推荐