| Blog信息 |
|
blog名称:注册会计师(注会)练习软件 日志总数:398 评论数量:116 留言数量:27 访问次数:3278631 建立时间:2005年6月6日 |

| |
|
[delpih编程]advstringgrid 底部的foote显示求和结果 软件技术
吕向阳 发表于 2010/4/7 8:51:56 |
| With the floating footer (for which the settings are organised in the property grid.FloatingFooter) an always visible fixed footer can be displayed in the grid. The floating footer can currently be organised in 3 different ways set by the FooterStyle property : fsFixedLastRow fsColumnPreview fsCustomPreview ---------------- In this sample application, the fsFixedLastRow style is choosen and the last row is used to display the column sums. The following method puts the column sums into the last row: procedure TForm1.UpdateSums; var i: Integer; begin for i := 1 to AdvStringGrid1.ColCount - 1 do AdvStringGrid1.Floats[i,AdvStringGrid1.RowCount - 1] := AdvStringGrid1.ColumnSum(i,1,AdvStringGrid1.RowCount - 2); AdvStringGrid1.FloatingFooter.Invalidate; end; -------------------------------------------- To synchronise updating the floating footer whenever a cell value changes through editing, the UpdateSums method is called from the OnCellValidate event which is triggered whenever editing changes a cell. procedure TForm1.AdvStringGrid1CellValidate(Sender: TObject; Col, Row: Integer; var Value: String; var Valid: Boolean); begin UpdateSums; end; ------------------------------------- |
|
|