cxGrid使用经验--不同的颜色

 

procedure TfrmOrderMgr.grdVMainStylesGetContentStyle(
  Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
  AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
var
  AIndex: Integer;
  AVar: Variant;
  ABoolean: Boolean;
  lvItem: TcxGridDBColumn;
begin
  lvItem := TcxGridDBColumn(AItem);

  if grdVMainFCompleted.GroupIndex <> -1 then Exit; //分组时不分颜色

  AIndex := grdVMainFCompleted.Index;
  AVar := ARecord.Values[AIndex];
  if VarIsOrdinal(AVar) then ABoolean := AVar else ABoolean := false; //是否为bool值

  if ABoolean then  //已完成
    AStyle := dmMain.cxStyleRecCompleted else AStyle := dmMain.cxStyleRecNormal;

  if lvItem.VisibleIndex = 0 then //第一列
  begin
    AIndex := grdVMainFClosed.Index;
    AVar := ARecord.Values[AIndex];
    if VarIsOrdinal(AVar) then ABoolean := AVar else ABoolean := false; //是否为bool值
    if ABoolean then  //已取消
      AStyle := dmMain.cxStyleRecClosed;
  end;
end;

posted @ 2008-07-28 10:52  D10.天地弦  阅读(724)  评论(0编辑  收藏  举报