Winforms: Close modal dialog when clicking outside the dialog

后端 未结 5 1325
旧巷少年郎
旧巷少年郎 2020-12-17 10:08

I have an open modal dialog (Windows Forms). I want, that the dialog is closed when clicking outside the dialog (on the parent form). How can I do that?

5条回答
  •  长情又很酷
    2020-12-17 10:43

    hi I think u can use the mouse down event or keydown event in the event find the location fo the mouse if that location is in minus values that means u have selected the outer area of the windows and then close that windows hope this help.

提交回复
热议问题