当 WinForm 移到其他 windows 后面时的事件

Event when WinForm is moved behind other windows

我有一个弹出菜单,当用户最小化表单时会显示该菜单。但是,当用户单击后台程序(例如 MS Word 文档)时,我的表单位于文档后面,但未最小化或隐藏。因此,我无法控制这一点。 VS上有Event可以用吗?

尝试 Form.Deactivate 事件:

http://msdn.microsoft.com/en-us/library/system.windows.forms.form.deactivate%28v=vs.110%29.aspx

来自 MSDN 的描述:

Occurs when the form loses focus and is no longer the active form.

您可以使用 WinForm 的停用事件

Private Sub Form1_Deactivate(sender As Object, e As EventArgs) Handles Me.Deactivate
'Your code Here
End Sub

使用 Form.Deactivate 事件,当表单失去焦点时调用。

http://msdn.microsoft.com/en-us/library/system.windows.forms.form.deactivate%28v=vs.110%29.aspx