how to use DBGRIDEH 急切!!!(200分)

  • 主题发起人 张剑波
  • 开始时间

张剑波

Unregistered / Unconfirmed
GUEST, unregistred user!
ooter and total values.
(1) To show footer row(s) need to set FooterRowCount property.
(2) To force grid to calculate total values need to activate SumList (DBGridEh.SumList.Active := True).
(3) In footer cell, it is possible to show sum value for specified of field, (record count, value of a field or static text). Use property Column.Footer.ValueType. If ValueType = fvtStaticText, then set the property Value. If ValueType = fvtFieldValue, then you need to set property FieldName.

(4) Set ValueType to fvtSum and grid must to show sum value for column field, you can also specify Column.Footer.FieldName to calculate total value for other field.
(5) If you have more then one footer row you can use Column.Footers collection to specify value for individual footer cell in column.
上面的E文看的有些明白,(1)(2)(3)看明白了,(4)(5)不太明白.
字段不知怎么指定.
请举个例子,叫DBGRIDEH下面的合计数能显示就行了.
看了半天DEMO,头都大了。

 
如果写程序,大抵如下所示:
DBGridEh.FooterRowCount := 1;
DBGridEh.FooterColor := clYellow;
DBGridEh.SumList.Active := True;

DBGridEh.Columns[0].Footer.ValueType := fvtStaticText;
DBGridEh.Columns[0].Footer.Value := '总计:';
DBGridEh.Columns[1].Footer.ValueType := fvtCount; //fvtSum

也可以在设计时设置其相应的属性。
 
DBGridEh有一个属性:FooterRowCount 设为1

双击DBGridEh,加入你的字段,选一个要合计字段,
属性:Footer 看看它的子属性FieldName,还有 ValueType
 
又是时间差
 
一点不爽,搞个footer还要另加个query,换dxdbgrid算了
 
多人接受答案了。
 
顶部