0

我有一个用于浏览我的 excel 工作簿的 winform。表单在 Workbook Open 事件中打开。一切正常,但我只是注意到,如果我的应用程序已打开并且我打开任何其他应用程序(例如 IE),我的 winform 将保持在顶部并且不会隐藏。当我的工作簿或应用程序失去焦点时,有没有办法告诉我的表单隐藏?

我搜索了 MSDN 和网络,但真的找不到任何东西?

    Private Sub NavigationForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    'This procedure runs when the form loads. The procedure displays
    'the form on the upper left hand corner of the main screen.
    'It also disables and hids the btnHideForm button.

    Me.Location = New Point(0, 0)

    With btnHideForm

        .Visible = True
        .Enabled = True

    End With


End Sub

Public Class ThisWorkbook

Private Sub ThisWorkbook_Startup() Handles Me.Startup

    Dim navForm As New frmNavigation
    navForm.Show()


End Sub

这是在表单加载和工作簿打开时运行的代码

4

0 回答 0