DiverDan said:
One thought would be to have your form detect the mouse click then send a delegated message via a public properity to the control.
The control would need to be hidden not only when the user clicks on the form, but when he clicks on any other control, even those that can't accept focus, as well as when the user clicks anywhere
outside the form.
I wanted my control to act very much like a context menu, in that when you click a button, it is displayed, allows him to make a selection (from a grid, thought, rather than a list of menuitems), then the control would disappear. And, like a menu, if the user clicks anywhere else on the screen, I want to hide the control and get it out of his way.
What I did is show a context menu with a single, owner drawn item. I do my drawing to the menuitem instead of a control, and when the user clicks, I take the mouse coordinates, and calculate where in the menu the user clicked. This method, however, gives me less control with respect to mouse events, and is less reliable.