我有这个超级网格:
http://s4.postimg.org/fhnjs4w4d/Capture.png
我需要将图片上带有红色标记的列中的自定义值传递给汇总单元格。
Infrastics允许我将Max、Min、Sum、Average等放在摘要单元格中,但我需要传递自定义值。
有什么帮助吗?
我有这个代码,它把最大值:
Dim columnToSummarizeVlrAq As UltraGridColumn = ugbBens.DisplayLayout.Bands(0).Columns(ugbBensColVlrAq)
Dim summaryVlrAq As SummarySettings = .Add(ugbBensColVlrAq,SummaryType.Maximum, columnToSummarizeVlrAq, SummaryPosition.UseSummaryPositionColumn)
这里的解决方案:
创建一个新类:
Public Class MyCustomSummarySettings
Implements ICustomSummaryCalculator
Private valor As Object = 0
Public Sub New()
End Sub
Public Sub Val()
End Sub
Private Sub BeginCustomSummary(ByVal summarySettings As SummarySettings, ByVal rows As RowsCollection) Implements ICustomSummaryCalculator.BeginCustomSummary
valor = 0
End Sub
Private Sub AggregateCustomSummary(ByVal summarySettings As SummarySettings, ByVal row As UltraGridRow) Implements ICustomSummaryCalculator.AggregateCustomSummary
'Primeiro mês
If summarySettings.Key = "COL_DeprAntExVlrRv" Then
If row.Index = 0 Then valor = CDbl(row.Cells("COL_DeprAntExVlrRv").Value)
End If
If summarySettings.Key = "fltVlrDepreciavelAct" Then
If row.Index = 0 Then valor = CDbl(row.Cells("fltVlrDepreciavelAct").Value)
End If
End Sub
Private Function EndCustomSummary(ByVal summarySettings As SummarySettings, ByVal rows As RowsCollection) As Object Implements ICustomSummaryCalculator.EndCustomSummary
Return valor
End Function
End Class
并调用具有摘要类型自定义的类,如下所示:
Dim custumSummary As New MyCustomSummarySettings
summaryDepreciavel = .Add(ugbBensColDepreciavelAceite, SummaryType.Custom, custumSummary, columnToSummarizeDepreciavel, SummaryPosition.UseSummaryPositionColumn, Nothing) '7ª Coluna
Dim custumSummary As New MyCustomSummarySettings
summaryDepreciavel = .Add(ugbBensColDepreciavelAceite, SummaryType.Custom, custumSummary, columnToSummarizeDepreciavel, SummaryPosition.UseSummaryPositionColumn, Nothing)