How do I close a form when a user clicks outside the form's window?

前端 未结 8 2023
孤独总比滥情好
孤独总比滥情好 2021-01-12 15:51

I want to close a System.Windows.Forms.Form if the user clicks anywhere outside it. I\'ve tried using IMessageFilter, but even then none of the messages are passed to PreFi

8条回答
  •  终归单人心
    2021-01-12 16:54

    If it is a child form in an MDI application, you could trap the click in the parent form, otherwise the solution will be messy.

    I am not convinced what you suggest represents intuitive UI behaviour anyway. Are you sure that is the best design?

提交回复
热议问题