private void findTextDialog_FormClosed(object sender, FormClosedEventArgs e) { Debug.Assert(sender == findTextDialog); findTextLocation = findTextDialog.Location; findTextOptions = findTextDialog.FindOptions; findTextDialog = null; }
private void findToolStripMenuItem_Click(object sender, EventArgs e) { if (findTextDialog == null) { findTextDialog = new FindTextDialog(); findTextDialog.FormClosed += new FormClosedEventHandler(findTextDialog_FormClosed); findTextDialog.FindText += new EventHandler <FindTextEventArgs>(findTextDialog_FindText); findTextDialog.FindOptions = findTextOptions; if (!findTextLocation.IsEmpty) { findTextDialog.Location = findTextLocation; } else { Point pos = Location; pos.Y += 50; pos.X += Width - findTextDialog.Width - 100; findTextDialog.Location = pos; } findTextDialog.Show(this); } else { findTextDialog.Focus(); } }