If CurrentTable Is Nothing Then
Return
End If
'此段代码用于更新日常工作区"整行"按钮的状态,,如果按钮已经改名或者移到别的功能区,请对应地修改此段代码
'如果删除了此按钮,应该删除此段代码
Static lm As RibbonMenu.ToggleButton
If lm Is Nothing Then
lm = RibbonTabs("Common").Groups("Edit").Items("ListMode")
End If
If lm.Pressed <> CurrentTable.ListMode Then
lm.Pressed = CurrentTable.ListMode
End If
'此段代码用于更新日常工作区"切换"按钮的状态,如果按钮已经改名或者移到别的功能区,请对应地修改此段代码
'如果删除了此按钮,应该删除此段代码
Static tb As RibbonMenu.ToggleButton
If tb Is Nothing Then
tb = CType(RibbonTabs("Common").Groups("SortAndFilter").Items("Toggle"), RibbonMenu.ToggleButton)
End If
If (CurrentTable.Filter > "" AndAlso CurrentTable.ApplyFilter = True) OrElse (CurrentTable.Sort > "" AndAlso CurrentTable.ApplySort = True) Then
If tb.Pressed = False Then
tb.Pressed = True
End If
Else
If tb.Pressed = True Then
tb.Pressed = False
End If
End If
'此段代码用于决定日常工作功能区的"筛选"按钮是否可用,如果按钮已经改名或者移到别的功能区,请对应地修改此段代码
'如果删除了此按钮,应该删除此段代码
Static fm As RibbonMenu.MenuButton
If fm Is Nothing Then
fm = CType(RibbonTabs("Common").Groups("SortAndFilter").Items("Filter"), RibbonMenu.MenuButton)
End If
If CurrentTable.Position < 0 OrElse CurrentTable.ColSel < 0 Then
If fm.Enabled Then
fm.Enabled = False
End If
Else
If Not fm.Enabled Then
fm.Enabled = True
End If
End If
'以下代码用于更新管理项目功能区"暂停计划"按钮的状态,如果按钮已经改名或者移到别的功能区,请对应地修改此段代码
'如果删除此按钮,也应该删除此段代码
Static tp As RibbonMenu.ToggleButton
If tp Is Nothing Then
tp = CType(RibbonTabs("Project").Groups("Timers").Items("Pause"), RibbonMenu.ToggleButton)
End If
If Mytimers.Pause Then
If tp.Pressed = False Then tp.Pressed = True
Else
If tp.Pressed Then tp.Pressed = False
End If
'以下代码用于更新配置栏"查阅模式"按钮的状态,如果按钮已经改名或者移到别的功能区,请对应地修改此段代码
'如果删除此按钮,也应该删除此段代码
Static bm As RibbonMenu.ToggleButton
If bm Is Nothing Then
bm = Ctype(ConfigBar.Items("BrowseMode"),RibbonMenu.ToggleButton)
End If
If DataTables.AllowEdit Then
If bm.Pressed Then bm.Pressed = False
Else
If bm.Pressed =False Then bm.Pressed = True
End If
'以下代码用于更新快速访问栏中的"撤销"和"重做"按钮的状态,如果按钮已经改名或者移到别的功能区,请对应地修改此段代码
'如果删除了这两个按钮,也应该删除此段代码
Static Undo As RibbonMenu.Button
Static Redo As RibbonMenu.Button
If Undo Is Nothing Then
Undo = QAT.Items("Undo")
Redo = QAT.Items("Redo")
End If
If CurrentTable.CanUndo Then
If Undo.Enabled = False Then Undo.Enabled = True
Else
If Undo.Enabled Then Undo.Enabled = False
End If
If CurrentTable.CanRedo Then
If Redo.Enabled = False Then Redo.Enabled = True
Else
If Redo.Enabled Then Redo.Enabled = False
End If
'以下代码用于在打印输出功能区动态显示各种打印选项设置,如果菜单中删除了这些选项,那么应该删除此段代码.
'如果更改了打印输出功能区的名称,或更改了相关功能组及选项的名称,也应该对应修改此段代码.
Dim t As Table = CurrentTable
If Vars("SysUpdatePrintInfo") = True Then
Vars("SysUpdatePrintInfo") = False
With t.PrintInfo
CType(RibbonTabs("Print").Groups("QuickSetting").Items("OnlySelected"), RibbonMenu.CheckBox).Checked = .OnlySelectedRows
CType(RibbonTabs("Print").Groups("QuickSetting").Items("FitIntoPage"), RibbonMenu.CheckBox).Checked = .FitIntoPage
CType(RibbonTabs("Print").Groups("QuickSetting").Items("ExtendMemoRow"), RibbonMenu.CheckBox).Checked = .ExtendMemoRow
CType(RibbonTabs("Print").Groups("QuickSetting").Items("AdjustFontSize"), RibbonMenu.CheckBox).Checked = .AdjustFontSize
CType(RibbonTabs("Print").Groups("QuickSetting").Items("PrintFixedCols"), RibbonMenu.CheckBox).Checked = .PrintFixedCols
CType(RibbonTabs("Print").Groups("QuickSetting").Items("WrapMemo"), RibbonMenu.CheckBox).Checked = .WrapMemo
CType(RibbonTabs("Print").Groups("QuickSetting").Items("PrintTitle"), RibbonMenu.CheckBox).Checked = .PrintTitle
CType(RibbonTabs("Print").Groups("QuickSetting").Items("PrintHeader"), RibbonMenu.CheckBox).Checked = .PrintHeader
CType(RibbonTabs("Print").Groups("QuickSetting").Items("PrintFooter"), RibbonMenu.CheckBox).Checked = .PrintFooter
CType(RibbonTabs("Print").Groups("DirectPrint").Items("DirectFitIntoPage"), RibbonMenu.CheckBox).Checked = .DirectFitIntoPage
CType(RibbonTabs("Print").Groups("DirectPrint").Items("DirectFitIntoOnePage"), RibbonMenu.CheckBox).Checked = .DirectFitIntoOnePage
CType(RibbonTabs("Print").Groups("DirectPrint").Items("DirectExtendLastCol"), RibbonMenu.CheckBox).Checked = .DirectExtendLastCol
CType(RibbonTabs("Print").Groups("DirectPrint").Items("DirectPrintHeader"), RibbonMenu.CheckBox).Checked = .DirectPrintHeader
CType(RibbonTabs("Print").Groups("DirectPrint").Items("DirectPrintFooter"), RibbonMenu.CheckBox).Checked = .DirectPrintFooter
CType(RibbonTabs("Print").Groups("DirectPrint").Items("DirectHighLight"), RibbonMenu.CheckBox).Checked = .DirectHighLight
End With
End If
'以下代码用于在状态栏显示自动计算结果,如果不需要自动计算,可删除这一段
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
With RibbonTabs("Other").Groups("Aggregate")
With CType(.Items("Aggregate"), RibbonMenu.ToggleButton)
If .Pressed = False Then
Return
End If
End With
If CType(.Items("Count"), RibbonMenu.CheckBox).Checked Then
Str1 = Str1 & "计数:" & t.Aggregate(AggregateEnum.Count, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
End If
If CType(.Items("Sum"), RibbonMenu.CheckBox).Checked Then
Str1 = Str1 & "累计:" & t.Aggregate(AggregateEnum.Sum, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
End If
If CType(.Items("Average"), RibbonMenu.CheckBox).Checked Then
Str1 = Str1 & "平均:" & t.Aggregate(AggregateEnum.Average, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
End If
If CType(.Items("Max"), RibbonMenu.CheckBox).Checked Then
Str1 = Str1 & "最大:" & t.Aggregate(AggregateEnum.Max, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
End If
If CType(.Items("Min"), RibbonMenu.CheckBox).Checked Then
Str1 = Str1 & "最小:" & t.Aggregate(AggregateEnum.Min, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
End If
With CType(.Items("Other"), RibbonMenu.MenuButton)
If CType(.Items("Std"), RibbonMenu.ToggleButton).Pressed Then
Str1 = Str1 & "标准差:" & t.Aggregate(AggregateEnum.Std, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
End If
If CType(.Items("StdPop"), RibbonMenu.ToggleButton).Pressed Then
Str1 = Str1 & "总体标准差:" & t.Aggregate(AggregateEnum.StdPop, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
End If
If CType(.Items("Var"), RibbonMenu.ToggleButton).Pressed Then
Str1 = Str1 & "方差:" & t.Aggregate(AggregateEnum.Var, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
End If
If CType(.Items("VarPop"), RibbonMenu.ToggleButton).Pressed Then
Str1 = Str1 & "总体方差:" & t.Aggregate(AggregateEnum.VarPop, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
End If
End With
End With
RibbonMenu.StatusBar.Message3 = Str1
End If