如何在VSTO中重新加载Ribbon的显示?

问题描述 投票:0回答:1

我想在

Button2
处理时显示
Button1

这是我的代码:我使用

Application.DoEvents()
,但它不能

Private Sub Button1_Click(sender As Object, e As RibbonControlEventArgs) Handles Button1.Click
        Button2.Visible = True
        Globals.Ribbons.Ribbon1.RibbonUI.Invalidate()
        Application.DoEvents()

        Dim WB = Globals.ThisAddIn.Application.ActiveWorkbook
        For iSheet = 1 To WB.Sheets.Count
            Dim oSheet = WB.Sheets(iSheet)
            For irow = 1 To 1000
                If bStop Then
                    Exit For
                End If
                For icol = 1 To 20
                    If bStop Then
                        Exit For
                    End If
                    oSheet.Cells(irow, icol).Value = "Cell" & irow & icol
                Next
            Next
        Next

        Button2.Visible = False


    End Sub

如何在VSTO中重新加载Ribbon的显示?

vsto
1个回答
0
投票

getVisible
上添加
Button2
回调。当您调用
RibbonUI.Invalidate()
时,它将调用您的
getVisible
回调,您可以从中返回所需的值(true 或 false)。

© www.soinside.com 2019 - 2024. All rights reserved.