C# tray context menu not hiding when message box
In my application I have context menu which is associated with tray icon of the application, when user click on About menu item, it display the message box. Message box is still visible, user right click again on tray icon, menu pop up, user click somewhere else than context menu should disappear, but it didn't, it is still display开发者_高级运维ed.
That's a bug. Probably in Windows, the MSDN Library documentation for TrackPopupMenu documents a very similar problem. I don't see an obvious workaround, other than avoiding using MessageBox. Create a little form to be your About box. Display it with the Show() method.
You could use SendKeys.Send("{ESC}"); in the trigger event when the user clicks somewhere else.
精彩评论