1、逻辑列问题
Dim sender As object = Args(0)
Dim ea As object = Args(1)
If sender.Name = "" Then Return Nothing '没有设置好Table 和底层的关联
If Tables.Contains(sender.Name) = False Then Return Nothing '不存在就退出
Dim tb As Table = Tables(sender.Name)
If tb.GrandTotal Then '如果处于合计模式
If sender.Rows(sender.Rows.count -1).Top < sender.Height - sender.rows(sender.rows.count -1).Height * 2 Then '如果原合计行可视
If sender.Controls.ContainsKey("Myhuizong") Then '删除合计行控件
sender.Controls.RemoveByKey("Myhuizong")
End If
Else
Dim hg As Integer = sender.rows(sender.rows.count -1).Height '控件高
If hg = -1 Then
hg = sender.rows(sender.rows.count -1).HeightDisplay
End If
Dim gh = sender.Height - 1
If sender.ScrollBarsVisible = 1 OrElse sender.ScrollBarsVisible = 3 Then '显示了水平滚动条
gh = gh - 19
End If
If sender.Controls.ContainsKey("Myhuizong") = False Then '不存在汇总控件,则添加
Dim huizong As new C1.Win.C1FlexGrid.C1FlexGrid
With huizong
.name = "Myhuizong"
.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None '无边框
.Cols.Count = sender.Cols.Count
.rows.count = 2
.Rows(0).Height = 0 '隐藏标题行
.Enabled = False '不能使用控件
End With
sender.Controls.add(huizong) '加入控件
End If
Dim hui As C1.Win.C1FlexGrid.C1FlexGrid = sender.Controls("Myhuizong")
If sender.ScrollBarsVisible = 0 OrElse sender.ScrollBarsVisible = 2 Then '显示了垂直滚动条
hui.ScrollBars = 2
Else
hui.ScrollBars = 0
End If
'With hui '调整位置
'.left = 0
'.Top = gh - hg - 1
'.width = sender.width -19
'.Height = hg + 2
'.Rows(1).Height = hg
'End With
With hui '调整位置
.left = 0
If sender.Rows(sender.Rows.count -1).Top < sender.Height - sender.rows(sender.rows.count -1).Height * 2 Then
.Top = sender.Rows(sender.Rows.count -1).Top 'sender.GetCellRect(sender.Rows.count-1, 1).y
Else
.top = gh - hg - 1
End If
.width = sender.width -19
.Height = hg + 2
.Rows(1).Height = hg
End With
Dim sLightBlue As C1.Win.C1FlexGrid.CellStyle = hui.Styles.Add("LightBlue")
sLightBlue.BackColor = Drawing.Color.PaleGreen
Dim i As Integer
Dim flag As Integer = -1
For i = 0 To sender.Cols.count -1
If sender.Cols(i).width = -1 Then '同步列宽
hui.Cols(i).width = sender.Cols.DefaultSize
Else
hui.Cols(i).widthdisplay = sender.Cols(i).widthdisplay
End If
If i > 0 Then hui.SetCellStyle(1,i,sLightBlue)
hui.Cols(i).Visible = sender.Cols(i).Visible '同步隐藏列
If sender.Cols(i).Visible AndAlso flag < 0 AndAlso i > 0 Then
hui(1,i) = "合计"
flag = i
End If
If i > flag Then
hui.Cols(i).Style = sender.Cols(i).Style '同步列样式
End If
Next
hui.Cols.Frozen = sender.Cols.Frozen '同步冻结列
hui.ScrollPosition = sender.ScrollPosition '同步水平滚动
For i = 2 To sender.Cols.count -1
If tb.Cols(i-1).GrandTotal Then
hui(1,i) = sender.Aggregate(C1.Win.C1FlexGrid.AggregateEnum.Sum,0,i,sender.Rows.count-2,i,1)
Else
hui(1,i) = Nothing
End If
Next
hui.ExtendLastCol = sender.ExtendLastCol
End If
Else '检查并删除控件
If sender.Controls.ContainsKey("Myhuizong") Then '删除控件
sender.Controls.RemoveByKey("Myhuizong")
End If
End If
2、选择不同的用户,其合计列,就是应该不同的啊,根据例子截图说明你的问题。