Close Modal Form when mouse click outside form area
问题 I would like to close a modal form when the user clicks outside (anywhere on the computer desktop) the modal form. How can we do this as a modal form is not meant to lose focus. 回答1: You need to hook mouse (and keyboard if required) and capture their events. Then check if the click happened outside the form (and area). If yes, flag a sign which can be read by the model form that it can close down. Algo: Hook mouse click event. When callback function is called, check for the click position -