cxgrid 怎么更改某一列的背景颜色呢?比如,某列背景色设置为红色,运行时,就算cxgrid中一条数据都没有,该列还是显示红色。网上找来找去,问来问去都是根据内容来变色的,要是cxgrid中没记录,那背景就一片白色了
解决方案 »
- 请教如何取一个运行程序的输入框数值?
- 动态在dbchart添加Series的问题。
- Delphi 编译问题
- winexec是不是可以调用所有的WINDOWS程序?
- 请问做DLL的时候,一般在什么情况下使用动态调用比较好,在什么情况下使用静态调用比较好?
- [microsoft][odbc sql server driver]没有执行可选特性
- 请问私营企业给不给住房公积金阿
- edit,combobox问题?送分了!
- LoginDialog('a', 'b', 'c')为什么通不过?
- MSSQL7.0高分求救(300分)一定加,现在只让给20
- 在onresize里面写form1.postion:=poScreenCenter;报错?
- setUpFactory7 打包Mapx5.0 问题,求帮忙。
clmStyle: TCxStyle;
begin
clmStyle:=tcxstyle.Create(Self);
clmStyle.Color:=clRed;
View1.Columns[0].Styles.Content:=clmStyle;
View1.Columns[0].Styles.Header:=clmStyle;
end;
//OnCustomDrawCell事件
procedure TForm1.cxGrid1TableView1CustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
begin
if SameText(Aviewinfo.Item.Name,cxGrid1TableView1.Columns[1].Name) then //指定你想要变色的列
begin
Aviewinfo.Focused;
ACanvas.Canvas.Brush.Color := clRed;
end;
end;
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
begin
if (SameText(Aviewinfo.Item.Name,cxGrid1TableView1.Columns[0].Name))
or(SameText(Aviewinfo.Item.Name,cxGrid1TableView1.Columns[2].Name)) then //指定你想要变色的列
begin
Aviewinfo.Focused;
ACanvas.Canvas.Brush.Color := clRed;
end;
end;