当左键单击系统托盘中最小化的应用程序并显示消息框时,对话框第一次显示时失焦,而第二次显示时确实有焦点。
谷歌似乎说解决方案是使用 MB_TOPMOST 参数配置对话框,但.Net MessageBox 对象似乎不支持此参数。
所以我用非.Net MsgBox尝试了以下方法,但它没有解决问题:
Public Class Form1
Private Sub LeftClick(sender As Object, e As EventArgs) Handles NotifyIcon1.Click
'Work-around to prevent Windows from triggering Click then right-click
Dim MyButton As System.Windows.Forms.MouseEventArgs = e
If MyButton.Button = MouseButtons.Left Then
'MessageBox apparently unable to handle MB_TOPMOST
'MessageBox.Show(Str, "Output", ???? )
'Doesn't work
Const MB_TOPMOST As Integer = &H40000
MsgBox("Hello there", MsgBoxStyle.OkOnly Or MB_TOPMOST, "Out of focus")
End If
End Sub
End Class
有人找到解决方法了吗?
谢谢你。