Is there any way to detect a mouseclick outside a user control?

后端 未结 6 1355
青春惊慌失措
青春惊慌失措 2020-12-10 12:33

I\'m creating a custom dropdown box, and I want to register when the mouse is clicked outside the dropdown box, in order to hide it. Is it possible to detect a click outside

6条回答
  •  独厮守ぢ
    2020-12-10 12:49

    You are probably looking for the leave event:

    http://msdn.microsoft.com/en-us/library/system.windows.forms.control.leave.aspx

    Leave occurs when the input focus leaves the control.

提交回复
热议问题