void photoForm_FormClosed(object sender, FormClosedEventArgs e) { if (photoForm != null) { photoForm.Dispose(); photoForm = null; } }
void showPhoto(Image photo) { if (photoForm == null) { photoForm = new PhotoForm(); photoForm.FormClosed += photoForm_FormClosed; photoForm.Show(); } photoForm.SetPhoto(photo); }