I have two forms, form1 and form2. form1 has a button that when clicked opens form2 center screen over form1. form2 is smaller than form1 (on purpose). If the click event is triggered and form2 is open, then the user clicks on form1, form2 falls to the background as most programs in windows do.
What I want: is when form2 is open, and the user clicks on something else, form2 closes.
I've tried (on form2):
private void formLostFocus (object sender, System.EventArgs e) { this.Close(); }
Would appreciate any advice.
Aucun commentaire:
Enregistrer un commentaire