1

在 cxgrid 中,我在页脚中求和时间(有问题的字段是时间字段)。我已将其属性更改为 TimeEdit,并将其时间显示格式更改为“tfHourMin”。但是我不能对底层页脚执行此操作。它一直显示 hh:mm:ss。有没有办法让页脚也显示“tfHourMin”格式???

编辑:如果我这样做,我会得到“无法将类型(Null)的变体转换为类型(Double)”错误

procedure TForm1.cxGrid1DBTableView1TcxGridDBDataControllerTcxDataSummaryFooterSummaryItems1GetText(
  Sender: TcxDataSummaryItem; const AValue: Variant; AIsFooter: Boolean;
  var AText: string);
begin
 AText := FormatDateTime('hh:mm', AValue);
end;
4

1 回答 1

0

您可以使用摘要项的OnGetText事件来提供您自己的要显示的文本,例如

procedure TForm1.H_FormatSummaryItem(Sender: TcxDataSummaryItem; const AValue: Variant; AIsFooter: Boolean; var AText: string);
begin
  if(TVarData(AValue).VType in [varNull, varEmpty])then AText := ''
  else begin
     if((Sender as TcxGridTableSummaryItem).Kind = skSum)then begin
        AText := FormatDateTime('hh:nn', AValue);
     end;
  end;
end;
于 2014-03-01T06:59:13.577 回答