您的位置:首页 > 其它

根据条件改变cxGrid行与列颜色

2011-03-30 10:35 330 查看
procedure TForm1.cxGrid1DBTableView1CustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
begin
//Item确定列(ID列的索引),RecordViewInfo确定行(Index行的索引)
//可以定位到某一行改变颜色
{if (AViewInfo.Item.ID = 0) and (AViewInfo.RecordViewInfo.Index = 0) then
ACanvas.Brush.Color := clred;}
//可以根据条件值确定改变某行颜色
if (trim(AViewInfo.RecordViewInfo.GridRecord.Values[4]) = 'HTT')
and (AViewInfo.Item.ID = 4) //确定到某一列,如果不加确定是某行底色
then
ACanvas.Brush.Color := clred;
end;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: