把 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; //背景颜色,可以改成你想要的
DBGrid.OnDrawColumnCell if (符合你的条件) then begin DBGrid1.Canvas.Font.Color := cred end else DBGrid1.Canvas.Brush.Color := clBackGround; DBGrid1.DefaultDrawColumnCell(Rect, DataCol,Column, State);
谢谢各位,假如我用的是一个listview,我该这样去任意改变某一级下的字体属性啊
同意把 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; //背景颜色,可以改成你想要的
if (符合你的条件) then
begin
DBGrid1.Canvas.Font.Color := cred
end
else
DBGrid1.Canvas.Brush.Color := clBackGround;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol,Column, State);
// 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; //背景颜色,可以改成你想要的