Search code examples
c#winformscontextmenutrayicon

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 displayed.


Solution

  • 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.