我有一个winform,用于浏览我的Excel工作簿。该表单将在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
这是在表单加载和工作簿打开上运行的代码