As a general rule, avoid TopMost unless you absolutely must not. If you absolutely must not, never have more than one TopMost form at a time. (After all, there can't be three TopMost forms--- somebody's got to lose).
First, verify that you're correctly setting the owner when you call Form.ShowDialog()
. This will make the new form more likely to appear in an appropriate location and all-around improve behavior of the application. Second, verify that you only have one TopMost window at any time. A combined failure to do these things could most definitely cause your problem. E.g.:
// MainForm.cs -- Don't do this
this.TopMost = true;
childForm.TopMost = true;
childForm.ShowDialog(/*no parent spec'd*/);
Now what happens? Both the main form and the child form are topmost, so one of them's got to lose. MainForm was active when it created childForm as topmost, but childForm doesn't have a parent. Maybe Windows decided to make the desktop its parent. This could result in the main form staying on the of the newly opened child form.