Winforms: Close modal dialog when clicking outside the dialog

后端 未结 5 1319
旧巷少年郎
旧巷少年郎 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 11:03

    You should change it to a non-modal dialog (open it with Show(..)) and then use the Deactivate event and close it.

提交回复
热议问题