I’m trying to implement a .net form control with functionality similar to a combo box, but I don’t know the proper method to intercept mouse events anywhere on the form to un-expand the list of items.
How do I prevent other controls from responding to mouse events while the list is being shown?
How do I efficiently and safely catch a mouse click event to anywhere on the form, to hide the expanded list?
Just use a
ToolStripControlHostalong with theToolStripDropDown, and it will work just like theComboBoxdropdown. You won’t have to worry about handling the mouse events.I’ve used this before:
Quick Demo with a Button control on a form:
To answer the question in your title, I think the pinvoke calls of SetCapture and Release Capture are used to handle that type of functionality.