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
this is simple :
private void button1_Click(object sender, EventArgs e) { Form f = new Form(); f.LostFocus +=new EventHandler(f_LostFocus); f.Show(); } void f_LostFocus(object sender, EventArgs e) { Form f = sender as Form; f.Close(); f.Dispose(); }