I have two dialogs, FormA
and FormB
. I use the following code to show (modeless) FormB
. The code is a button click executed from FormA
.
private void button_Click(object sender, EventArgs e)
{
FormB fB = new FormB();
fB.Show(this); // FormA is the owner of FormB
}
The problem is that when FormB
is over FormA
on the screen, if I click FormA
, it is activated, but not brought to front. Actually FormB is always over FormA
Do you know why, and how to change this behavior, without remove the owner property?
NOTE: This is a simplification of my problem. In the real problem, FormA is a Windows Explorer window, and FormB is a managed WinForm, but the behavior is the same. If I do not pass the IWin32Window to Show()
, it works fine, but If I close A, B is not closed and it does not respond to events (see the following entry).