天天看點

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;

繼續閱讀