有自定义的独立窗口,也有主窗口的情况下。如何在systemidel实现下述计算,并显示在右下角?
Dim t As Table = CurrentTable
With t.Form
If t.Form.Strips.Contains("screennotice") Then
Dim it As Winform.StripItem = .Strips("状态栏").Items("screennotice")
it.Text = "个数:" & t.Aggregate(AggregateEnum.Count, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " 累计:" & t.Aggregate(AggregateEnum.Sum, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol)
End If
End With
将上述代码放到systemidel里面,遇到主窗口就会出错。因为主窗口的T.form会报错。如何实现?
而下面的代码是OK的。但是这个代码对于独立窗口下面Strips("状态栏").Items("screennotice")不起作用。
Dim t As Table = CurrentTable
Dim str1 As String = ""
With t
RibbonMenu.StatusBar.Message3 = ""
If .TopRow = .BottomRow AndAlso .LeftCol = .RightCol Then
Return
End If
RibbonMenu.StatusBar.Message3 = "个数:" & .Aggregate(AggregateEnum.Count, .TopRow,.LeftCol,.BottomRow,.RightCol) & " 累计:" & .Aggregate(AggregateEnum.Sum,.TopRow,.LeftCol,.BottomRow,.RightCol)
End With
RibbonMenu.StatusBar.Refresh
Dim t As Table = CurrentTable
If t.Form Is Nothing Then
Dim str1 As String = ""
With t
RibbonMenu.StatusBar.Message3 = ""
If .TopRow = .BottomRow AndAlso .LeftCol = .RightCol Then
Return
End If
RibbonMenu.StatusBar.Message3 = "个数:" & .Aggregate(AggregateEnum.Count,.TopRow, .LeftCol, .BottomRow, .RightCol) & " 累计:" & .Aggregate(AggregateEnum.Sum, .TopRow, .LeftCol, .BottomRow, .RightCol)
End With
RibbonMenu.StatusBar.Refresh
Else
With t.Form
If .Strips("状态栏").Items.Contains("screennotice") Then
Dim it As Winform.StripItem = .Strips("状态栏").Items("screennotice")
it.Text = "个数:" & t.Aggregate(AggregateEnum.Count, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " 累计:" & t.Aggregate(AggregateEnum.Sum, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol)
End If
End With
End If
可以用