SystemIdle 事件:
If CurrentTable Is Nothing Then
Return
End If
'以下代码用于在状态栏显示自动计算结果,如果不需要自动计算,可删除这一段
Dim t As Table = CurrentTable
If Vars("SysUpdateAggregate")
If Windows.Forms.Control.MouseButtons <> Windows.Forms.MouseButtons.None OrElse Windows.Forms.Control.ModifierKeys <> Windows.Forms.Keys.None Then
Return
End If
Dim Str1 As String = ""
Vars("SysUpdateAggregate") = False
Str1 = Str1 & "计数:" & t.Aggregate(AggregateEnum.Count, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
Str1 = Str1 & "累计:" & t.Aggregate(AggregateEnum.Sum, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
Str1 = Str1 & "平均:" & t.Aggregate(AggregateEnum.Average, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
RibbonMenu.StatusBar.Message3 = Str1
End If
AfterSelRangeChange事件:
Dim t As Table
RibbonMenu.StatusBar.Message3 = ""
Vars("SysUpdateAggregate") = False
If e.Table IsNot CurrentTable OrElse CurrentTable Is Nothing Then
Return
Else
t = CurrentTable
End If
If t.TopRow = t.BottomRow AndAlso t.LeftCol = t.RightCol Then
Return
End If
For c As Integer = t.LeftCol To t.RightCol
If c < 1 Then
Continue For
End If
If t.Cols(c).IsNumeric = False Then
Return
End If
Next
Vars("SysUpdateAggregate") = True