把 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; //背景颜色,可以改成你想要的
// 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; //背景颜色,可以改成你想要的